How to use a set of numbers to find to closest to X without going under

So what I want to do is to be able to give a set of numbers and a target number and be able to get as close to that target as possible without going under.

As a very simple example if I gave it the numbers 1, 2, 3, 100 and a target of 4 it would output 1 and 3, but if I asked it for 10 it would give me 100. Not sure if it’s even possible with calc or not.

Found something that seems close to what I’m looking for here, but I can’t seems to get it to work with Calcs Solver

Excuse my lack of understanding - isn’t the result 1 + 2 + 3 = 6 for 10? 100 is much further from 10 than 6 …

I don’t just need to get as close as possible. The value is the minimum acceptable value. So in the example I need to have at least 10. I want to get as close as I can, but it can’t be less than the target.

The Setter extension was created specifically for solving such problems

1 Like