Add any combination of cells to get a specific sum

Jane01

New Member
Joined
Dec 6, 2005
Messages
1
I have 100s of cells containing various numeric amounts. There is a specified amount I need to find, which will be the sum of any number of values - could be 2 values, could be 12.

For example I have the following data:

10
20
30
40
50
60
70
80
90
100

Let's say my target value is 150. Obviously there are several ways I could add these numbers to get 150. I need a formula that will combine various values to get my target number.

For the life of me, I can't figure out how to do this.

Thoughts?
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Welcome to the board.

Do you want ALL of the combinations? Or just ONE solution?

If you want one solution, and the number of values will not exceed 16, you could use solver (tools --> solver... requires the solver add-in).

Define your your target cell = SUMPRODUCT(A1:A16,B1:B16) = to 150 or whatever by changing cells B1:B16 subject to the constraing that B1:B16 are binary.

Assuming solver can find a solution, solver will place a 1 next to the included values.

(See solver's help after clicking on options for more descriptions)
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,436
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top