Calculation Issues

Use Excel Solver to Find the Best Combination of Number Multiples

Algirdas JasaitisAlgirdas Jasaitis Nov 12, 2026 870 views

Question details

Find nonnegative integer multipliers for a list of source numbers so their weighted total reaches or exceeds a target while using the fewest terms, the smallest excess, or both.

Find the Best Combination of Number Multiples with Excel Solver
Product
Microsoft Excel Solver
Device & OS
not provided
Scenario
The user needs to select repeated multiples of available numbers to meet a target total, such as 18,000, through integer optimization.
Observed behavior
A manual search through possible repeated-number combinations is difficult, especially when the user must compare both the number of terms and the amount above the target.
Before you start

Arrange the available source numbers in one contiguous column or row, with an adjacent blank range for their multipliers. Make sure the Solver add-in is enabled in Excel through File > Options > Add-ins before creating the model.

Solution 1Recommended

Minimize the number of terms with integer constraints in Excel Solver

Use this method when the main goal is to reach or exceed the target with the fewest selected number multiples.

Create one formula for the weighted total and another for the total number of selected terms. Solver changes only the multiplier cells, which must be nonnegative integers.

1
Set up source values and multipliers

Enter the available numbers in a range such as A2:A10. In B2:B10, enter starting multiplier values such as 0; each cell in this range represents how many times its matching source number can be used.

2
Calculate the weighted total

In a total cell, such as D2, enter =SUMPRODUCT(A2:A10,B2:B10). This formula calculates the sum of each source number multiplied by its multiplier.

3
Calculate the number of terms

In another cell, such as D3, enter =SUM(B2:B10). This returns the total count of selected terms, including repetitions.

4
Open and configure Solver

Go to Data > Solver. Set the objective cell to D3, choose Min, and set By Changing Variable Cells to B2:B10.

5
Add target and integer constraints

Select Add and set D2 >= 18000, replacing 18000 with your target if needed. Add B2:B10 = int and B2:B10 >= 0. Choose Simplex LP where available, then select Solve and keep the solution.

Minimize the number of terms with integer constraints in Excel Solver
Result interpretation: The multiplier range shows how many times to use each source number. The SUMPRODUCT result is the achieved total, and the SUM result is the minimum number of terms found under the constraints.
Optimize number combinations in a spreadsheet

Use WPS Spreadsheets Solver for Integer Combination Optimization

WPS Spreadsheets can build the same weighted-sum model with SUMPRODUCT and SUM, then use Solver to test nonnegative integer multipliers. Set a target constraint, minimize the number of terms, and optionally run a second model to minimize excess.

  1. 1. Enter values and multiplier cells: In WPS Spreadsheets, place source values in one range and enter 0 as the starting value in an adjacent multiplier range.
  2. 2. Add total formulas: Use =SUMPRODUCT(value_range,multiplier_range) for the achieved total and =SUM(multiplier_range) for the number of terms.
  3. 3. Open Solver: Select Data > Solver and choose the term-count formula cell as the objective to minimize.
  4. 4. Add optimization constraints: Set the weighted-total cell to be greater than or equal to the target, then set the multiplier range as integers and greater than or equal to 0.
  5. 5. Solve and refine excess if needed: Run Solver, then fix the returned minimum term count and minimize a separate total-minus-target formula to find the closest valid result.
Use SUMPRODUCT to calculate a weighted total from values and multipliers.Apply integer and nonnegative constraints to prevent fractional or negative selections.Minimize the term count and then optimize the excess over the target.Open and edit Microsoft Excel .xlsx files with compatible spreadsheet formulas and layouts.
microsoft office alternative - wps office

Frequently Asked Questions

What formula calculates a total from values and their multipliers?

Use SUMPRODUCT, such as =SUMPRODUCT(A2:A10,B2:B10). The first range contains the available values and the second range contains the corresponding multipliers.

How do I prevent Solver from returning decimal multipliers?

In the Solver Parameters window, select Add, choose the multiplier range, and apply the int constraint. Also add a >= 0 constraint so Solver cannot use negative multipliers.

How can I make the total at least 18,000 instead of exactly 18,000?

Add a Solver constraint for the weighted-total cell, such as D2 >= 18000. Solver can then return a valid total above 18,000 when an exact match is not possible.

Why should I minimize the number of terms and excess in separate Solver runs?

The fewest terms and the smallest excess can conflict. First minimize the SUM of the multipliers, then set that result as an equality constraint and minimize the excess formula.

Which Solver method should I use for this model?

Use Simplex LP when the total and objective formulas are linear, such as SUMPRODUCT and SUM, and apply integer constraints to the multiplier cells. If your model includes non-linear formulas, use an appropriate non-linear Solver method instead.