Forum Discussion

sybtan05's avatar
sybtan05
Copper Contributor
Oct 14, 2025

Support Required: Finding Matching Number Combinations

I have two sets of data that need to be reconciled, and I need to find which combinations of numbers can sum up to a specific value, can show me the excel formulae. 

1 Reply

  • NikolinoDE's avatar
    NikolinoDE
    Platinum Contributor

    You have two sets of numbers, and you want to find which combination(s) of numbers (from one or both sets) sum to a specific target value — right?
    This is a subset sum problem, which Excel can handle in a few ways (depending on how complex your data is).

     

    Formula-only (if you need Excel formulas)

    If your dataset is small (say ≤ 15 items), you can use array formulas.

    Suppose:

    • Numbers are in A2:A10
    • Target sum is in C1

    You can test for matching subsets using a brute-force enumeration approach, but Excel formulas alone can’t easily “iterate” through all combinations. However, you can highlight matching combinations with formulas.

    For example:

    =IF(SUM($A$2:$A$10)=C1,"Exact Match","")

    …but that only checks if the whole range sums to the target, not combinations.

    So for pure formulas, the best you can do is use SUMIF/SUMIFS if you have grouping logic (like matching IDs or categories).

     

    If you want use Excel’s built-in Solver

    This is the most reliable and flexible method for finding combinations that sum to a specific value.

    Example

    Say your numbers are in A2:A10, and your target sum is in C1.

    Steps

    In column B2:B10, create binary selection cells — they’ll indicate whether each number is included:

    B2: =IF(A2="","",0)

    (Then copy down to B10.)

    Create a sum formula to compute the total of selected numbers:

        C2: =SUMPRODUCT(A2:A10, B2:B10)

        Go to Data → Solver (you might need to enable it in Add-ins first).

        Set up Solver:

            Set Objective: $C$2

            To: Value Of: and enter your target value (e.g. $C$1)

            By Changing Variable Cells: $B$2:$B$10

            Add Constraints:

                $B$2:$B$10 = binary (you can set this under "Add → bin" for binary values)

        Click Solve.

    Solver will set 1s and 0s in column B to identify the combination of numbers in column A that add up to your target.

     

    My answers are voluntary and without guarantee!

     

    Hope this will help you.

Resources