Hi I am new here and was hoping one of you could help me.

Note, this topic is similar to some out there, but none have answered this exact question.

It is exactly the same as this unanswered question: https://stackoverflow.com/questions/31248379/vba-to-extract-values-from-a-list-until-the-sum-is-within-a-certain-range

My problem is the following: as an excel user I have a column of numbers, say

5, 6, 7, 8, 8, 9, 14, 17

and what to know all the combinations of sums that fall, for example, within the 25 - 35 range. I will likely only have 4-5 entries/column numbers.

There is one more restriction: I want the combinations to be as small as possible, but still within the range.

so 17 + 9 = 26 is good but 17 + 9 + 5 = 31 is bad (should not be counted) because the group is larger than necessary although it still is within the range.

So overall, I want to get all the possible combinations of numbers in a column that sum to fall within a specific range where the sums are as small as possible, but still within the range.

Hope anyone can help! If not, does anyone know where I might find info to I can learn coding myself :)

Cheers and have a great weekend!!