VAB or Formula, subset SUM problem

jamiguel77

Board Regular
hi all, anyone know this algoithm?

i have this problem:

have this subset: (5,13,9,12,22,50,18) (A1,B1,C1,D1,E1,F1,G1)
and in A2, have this number: 36

How to determine wich elements of the set of numbers sum 36 in this case is: 13+18+5

Thanks

Or 5+9+12

Rick Rothstein

MrExcel MVP
Or 5+9+12
That totals 26, not 36... did you perhaps mean 5+9+22 ? Another one is 5+13+18.

Last edited:

PCL

Well-known Member
A way to do
Assuming data in row 1 from A to G
Put 0 in row 2 from A to G
In H3 put =SUMPRODUCT(A1:G1*A2:G2)

Call (or install first) the solver
Set target H3
by changing cells A2:G2
Subject to the Constraints
A2:G2 = binary
OK

jamiguel77

Board Regular
oooo solved with solver......

give me 5,13,18 (in this order)

https://imgur.com/a/ooy3k

dude: why do this result: 5,13,18

and not:

5,9,22 ? or exist other way for get more results?

thanks

jamiguel77

Board Regular
other q:

a friend say: sumMatch can do this work..

i am checking this way too..

thanks

PCL

Well-known Member
Excel stops when one possibiliy is found, if you change the daata order result will change
If you want all possibilties it is another story and need a macro .

Forum statistics

1,082,309
Messages
5,364,424
Members
400,801
Latest member
julievandermeulen

This Week's Hot Topics

• populate from drop list with multiple tables
Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
• Find list of words from sheet2 in sheet1 before a comma and extract text vba
Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
• Dynamic Formula entry - VBA code sought
Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...