T
Tony
How to find a set of numbers to sum the nearest by defect to a given
total but not more?
I have a set of numbers (invoice amounts) with decimals and want to
find a set of numbers to sum the nearest by defect to a given total but
not more. How to do it?
For instance, if I had the numbers 1, 3, and 10, and I wanted the set
to sum a total of 13 (or nearest one, not more), I would choose 3 & 10.
If I wanted a total of 14, I would choose them all, and if I wanted,
say, 9, I would choose 1 & 4 as the nearest one (not 10, since 10 is
more than the total 9).
Thanks!
total but not more?
I have a set of numbers (invoice amounts) with decimals and want to
find a set of numbers to sum the nearest by defect to a given total but
not more. How to do it?
For instance, if I had the numbers 1, 3, and 10, and I wanted the set
to sum a total of 13 (or nearest one, not more), I would choose 3 & 10.
If I wanted a total of 14, I would choose them all, and if I wanted,
say, 9, I would choose 1 & 4 as the nearest one (not 10, since 10 is
more than the total 9).
Thanks!