Calculation Issues

Find Numbers That Add Up to a Target Sum in Excel

Olivia MillerOlivia Miller Nov 18, 2026 870 views

Question details

Find a combination of spreadsheet values that adds up to a specified target.

Find Numbers That Add Up to a Target Sum in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
The user has a set of numbers and wants to identify which values produce a target total, optionally selecting a specific number of values.
Observed behavior
The desired result is a selection of values whose sum equals the target.
Before you start

Place the source numbers in a single column and decide on the target sum. If each number can be used only once, plan to use a 0-or-1 selection cell beside each value.

Solution 1Recommended

Use Excel Solver to find a combination

Use Solver to select values that reach a target, with an optional limit on the number selected.

SUM adds values you specify, but it does not search for combinations. Solver can change selection cells while SUMPRODUCT calculates the selected total.

1
Enable Solver

In Excel for Windows, go to File > Options > Add-ins. Under Manage, select Excel Add-ins, click Go, check Solver Add-in, and click OK. On Mac, use Tools > Excel Add-ins to enable Solver.

2
Set up the values

Enter the numbers in A2:A11 and enter 0 in each corresponding selection cell in B2:B11. Adjust these ranges if you have a different number of values.

3
Calculate the selected total

In C1, enter =SUMPRODUCT(A2:A11,B2:B11). To require a specific number of selected values, also enter =SUM(B2:B11) in C2.

4
Configure Solver

Go to Data > Solver. Set the objective to C1, choose Value Of, and enter the target sum. Set B2:B11 as the changing variable cells, then add a binary constraint for B2:B11. If needed, add a constraint setting C2 equal to the required number of selections.

5
Solve and review

Choose Simplex LP as the solving method and click Solve. If Solver finds a solution, choose Keep Solver Solution; the values beside 1s in column B make up the selected combination.

Use Excel Solver to find a combination
A match is not guaranteed: Some targets have no exact combination. Solver may also stop before finding a solution if it reaches a time or other limit.
Find combinations in WPS Spreadsheets

Find a target sum with WPS Spreadsheets

For a small set of values, use formulas in WPS Spreadsheets to list possible selections and filter their totals for a match.

  1. 1. Enter the values: In WPS Spreadsheets, enter 10 source numbers in B1:K1. Each position represents one value that can be selected once.
  2. 2. Generate selection patterns: Enter =ROW()-2 in A2 and fill it down through A1025. In B2, enter =MOD(INT($A2/2^(COLUMN()-COLUMN($B$2))),2), then fill the formula across to K2 and down through row 1025.
  3. 3. Calculate each total: Enter =SUMPRODUCT($B$1:$K$1,B2:K2) in L2 and fill it down through L1025. Each row represents one of the 1,024 possible selections.
  4. 4. Filter for the target: Select the table and use Data > Filter to filter column L for your target total. In a matching row, the 1s in columns B:K identify the selected source values in row 1.
Find exact target-sum combinations by filtering calculated totalsOpen and edit Microsoft Excel XLSX and XLS filesUse familiar spreadsheet formulas and filtersWork with a free, easy-to-use office suite
microsoft office alternative - wps office

Frequently Asked Questions

Can SUM find which numbers add up to my target?

No. SUM adds a specified range, but it does not search for combinations. Use Data > Solver with selection cells and a SUMPRODUCT formula to search for a match.

How do I select exactly 10 numbers in Excel Solver?

Enter =SUM(B2:B11), or the equivalent for your selection range, in a cell. In Data > Solver, add a constraint setting that cell equal to 10 and set the selection cells to binary.

What do the zeros and ones in the selection cells mean?

A 1 includes the corresponding source value in the SUMPRODUCT total; a 0 excludes it. A binary constraint ensures each value is either selected once or not selected.

What if Solver cannot find an exact total?

Check the target, ranges, and constraints in Data > Solver. There may be no exact match, or Solver may have reached a limit before finding one.

Can I use the WPS formula method for more than 10 values?

Yes, but you must expand the value and selection ranges and generate 2^n rows for n values. The number of combinations grows quickly, so this method is best for small sets.