Number Combination
Hi
This is going to be horribly mathematically intensive to do but I'm hoping
someone will know how to do it - I'm very happy with VBA but can't quite get
my head round this one....
I've got list of up to 120 numbers in column A. These numbers are dollar
values and may be positive or negative.
Some combination(s) (when summed) of UP TO 10 cells will equal the number
that I'm looking for. How do I find all the combinations that match the
number I'm looking for?
Here's a much simplified version:
A1 = 10
A2 = 20
A3 = 30
A4 = 40
A5 = 50
A6 = -20
If the total I'm looking for is 50, it needs to return the cell addresses
(or their values)
A1 + A4 (10+40)
A2 + A3 (20+30)
A3+A4+A6 (30+40-20)
A5 (50) and so on and on and on......
It doesn't matter (almost) how long it takes to run - just being able to get
the answer is the really important thing.
Any bright ideas?
Many thanks
David
|