Split value 100 in different values so that sum should be equal to 100

Hello Community Friends,

I am stuck in a scenario which is complex for me to implement. Scenario is : I have rows in excel sheet which is dynamic . sometimes it could be 2, sometimes 5, sometimes 12 means any number of rows could be there. i need to assign different unique values to each available row in such a way that their sum should be equal to 100. Example : if i have 2 rows i can assign values 65 and 35 but not 50 to both as the value needs to be unique. similarly if i have 4 rows i need to assign values like 20,30, 27, 23 .

How can i do this ? Need help with this one ASAP. It is an urgent one.

Thank you .

Hi,

How about the following?
I think maximum number of rows is 13, right?

Sequence1.xaml (6.9 KB)

Regards,

1 Like

this solution is working fine. But there is one condition that i just got to know from the business team that the values to be assigned should not be less than 10. Can you modify this accordingly? is it possible ?

following approach from @Yoichi
we would change
Enumerable.Range(10,numberOfRows -1) But then the maximum numbers of rows will be 8
in case of you need more dynamics within the different numbers, just let us know.

2 Likes

Yes i am fine with maximum number of rows as 8. Thank you for the solution. @Yoichi @ppr

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.