Forum Discussion
mcinqb3
Mar 16, 2024Copper Contributor
How to find which combination of multiples of a set of 5 numbers will return a given value
Hi all. New to excel, but decent using spreadsheets for trivial things. Right now, I'm trying to figure out which combinations of a set of 5 numbers or their multiples will give me a sum of AT LE...
Rodrigo_
Mar 16, 2024Iron Contributor
mcinqb3
You can achieve that using the 'Excel Solver', if you're not familiar with it. You can use these steps in order to do that.
- Create the model:
- Assuming your set of numbers in A3:A7 (1922, 2404, 3013, 3788, and 4755)
- Add a blank column to the right of your numbers (Column B)
- Calculate the sum:
- In a separate cell (B13), enter the following formula:
=SUMPRODUCT(A3:A7, B3:B7)
- In a separate cell (B13), enter the following formula:
- Run the Solver:
- On the Data tab, in the Analysis group, click the Solver button.
- Configure the Solver Parameters:
- Set the objective cell to the address of the formula cell (B13).
- Specify the desired sum value (e.g., 18,000) in the Value Of section.
- Select the range to be populated with the results (B3:B7) as the By Changing Variable Cells.
- Add constraints if needed (e.g., binary constraints for whole numbers).
- here's what it should like:
- Solve the problem:
- Click the Solve button.
- The Solver Results dialog will appear, showing which numbers (or their multiples) contribute to the desired sum.
- Press OK
To make the solver option appear, follow these steps:
- Go to Developer tab
- Click on Excel Add-ins
- Check Solver Add-in and press OK
- Now go to Data tab, and you will see the Solver in right most pane.