You are here:

Advanced Math/Finding the sum of a subset

Advertisement


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!

Answer
Questioner:   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.  

Advanced Math

All Answers


Answers by Expert:


Ask Experts

Volunteer


Paul Klarreich

Expertise

I can answer questions in basic to advanced algebra (theory of equations, complex numbers), precalculus (functions, graphs, exponential, logarithmic, and trigonometric functions and identities), basic probability, and finite mathematics, including mathematical induction. I can also try (but not guarantee) to answer questions on Abstract Algebra -- groups, rings, etc. and Analysis -- sequences, limits, continuity. I won't understand specialized engineering or business jargon.

Experience

I taught at a two-year college for 25 years, including all subjects from algebra to third-semester calculus.

Education/Credentials
-----------

©2012 About.com, a part of The New York Times Company. All rights reserved.