How to find a find a list of possible inputs to sum a known amt?

G

Guest

I have a known dollar amount and a range of lesser dollar amounts that I need
to find possible sinarios that will add up to the known dollar amount.
Example:

Known Amt = $30
Range of Numbers:
a=$10
b=$10
c=$50
d=$20
e=$30
f=$15
g=$5
possiblilites: (a,d)(b,d)(a,f,g)(b,f,g)(e)

Any ideas?
 
B

Bernard Liengme

In A1:G1 enter your values 10,10,50,20,30,15,5
In A2:G2 enter seven 0's
Copy down to row 8
Now in the matrix A2:H8 make the diagonal 1
(eg A2, B3, C4 ... make 1's) ---- this gives us different starting
conditions for Solver
In H2 enter =SUMPRODUCT($A$1:$G$1,A2:G2)
Copy this down to G8
Start Solver; make the Target blank
Make By Changing: A2:G8
Add constraint A2:G8 Bin (binary - we want 0 or 1 in each cell)
Second constraint H2:H8 = 30
Run Solver
I got these answers
$10 $10 $50 $20 $30 $15 $5
1 0 0 0 0 1 1 30
0 1 0 0 0 1 1 30
0 1 0 1 0 0 0 30
0 0 0 0 1 0 0 30
0 0 0 0 1 0 0 30
0 1 0 0 0 1 1 30
0 1 0 1 0 0 0 30
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top