Advanced Math/Finding the sum of a subset
Expert: Paul Klarreich - 7/29/2008
QuestionHi.
I have a small list of numbers and a result. I would like excel to find a certain combination of these numbers which sum to the result.
Eg.
List Data:
6
12
5
42
9
10
Result: 73
What formula or function would I use to work out the correct 'combination' of numbers from the list to arrive at the result? I know the answer is the sum of 12, 42, 9, and 10 but I don't know what formula can work this out.
I hope you can help.
Thank you!
AnswerQuestioner: Anthony
Category: Advanced Math
Private: No
Subject: Finding the sum of a result
Question: Hi.
I have a small list of numbers and a result. I would like excel to find a certain combination of these numbers which sum to the result.
Eg.
List Data:
6 12 5 42 9 10
Result: 73
What formula or function would I use to work out the correct 'combination' of numbers from the list to arrive at the result? I know the answer is the sum of 12, 42, 9, and 10 but I don't know what formula can work this out.
I hope you can help.
Thank you!
.........................................
Hi, Anthony,
I don't know of any one formula for this, but here is an approach that might work.
1. Write the numbers from 0 to 63 (all the 6-bit numbers) in binary form: 000000 to 111111.
2. Each number represents one of the 64 subsets.
3. For each of them in binary form, make the subset. For example, the number 010111 represents the subset { 12, 42, 9, 10 }.
4. Compute the sum for that subset. If it is the right one, mark it in some way.
That should do it.