Suppose I have a table of this type:
AB 3
CD 1
Ef 2
Gh 4
The sum of the last column is 10, and I need the largest values, the sum of which is at least 60% of the total value. So in this case it will return
Gh 4
AB 3
It reaches 70%, but if only the first value is selected, it will increase to 40%. Despite the fact that there may be a combination that returns exactly 60%, we want to take the largest numbers.
So, I think that I know how to sort the values โโfrom the largest to the smallest and how to sum all the values, but I do not know how then to take only the lines summing up to 60%.
source share