# Thread: List the numbers that their sum is equal to the desired value

1. ## List the numbers that their sum is equal to the desired value

Hello
Users in cell BO1, enter the number you want by entering the numbers that their sum is equal to the desired number to the list
I need the vba code to solve the problem
attached file

2. Understand my question?

3. general,

Here is some code slightly modified form this site:

http://www.tushar-mehta.com/excel/te...e_combinations

Enter the Sum value in C3. In C2, enter the number of combinations you want returned; entering zero will return them all. Select from C2 down to include the numbers used in the combinations. All the combinations will be returned in column D.

combinations1.png

The code can be adapted to use the format matrix you supplied. The consensus is that this could best be achieved by Excel's Solver Tool.

HTH,
Maud

5. ## List the numbers that their sum is equal to the desired value

tanks Maud
The answer is wrong to attach files

6. Does your selection prior to running the code include cells C2 and C3?

7. Yes
I run
But the answer is wrong
Untitled2.png

8. general,

It is actually the correct answer. The 2,5 combination is the second number (1100) and the 5th number (1400). The 3,4 combination is the 3rd and 4th numbers are 1200 and 1300, respectively.

HTH,
Maud

9. ## The Following User Says Thank You to Maudibe For This Useful Post:

10. Tanks Maud
The question was solved

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•