how to matcha sum value with bunch of numbers
You can “match a sum value with a bunch of numbers” by finding which numbers in your list add up to a target. In Excel, the most common ways are:
- Use Solver (built-in, good for one solution)
- Use a custom function / VBA (to find all combinations)
- Use an add‑in like SumMatch (simpler UI, no Solver needed)
Below is a practical, step‑by‑step approach using Excel.
Quick overview: what you’re solving
You have:
-
A list of numbers (e.g. invoices, amounts):
A2:A10=919, 1272, 629, 2000, 500, ... -
A target sum (e.g. payment to match):
C1=2820
You want to find which subset of A2:A10 adds up to C1. Mathematically,
this is the subset sum problem ; Excel can solve small cases well.
Method 1: Excel Solver (recommended for most users)
Step 1: Prepare your sheet
Assume:
- Numbers in
A2:A10 - Target sum in
C1
Add a binary selector column in B2:B10:
- These will be
0or1to indicate whether each number is included.
In B2 type: 0
Copy down to B10. In C2 (calculated sum of selected numbers):
excel
=SUMPRODUCT(A2:A10, B2:B10)
In C3 (difference from target):
excel
=C2 - C1
We want C3 to be 0.
Step 2: Enable Solver
If you don’t see Solver:
- Go to File > Options > Add‑Ins.
- At the bottom, choose Excel Add‑ins , click Go.
- Check Solver Add‑in , click OK.
Now Solver is under Data > Solver.
Step 3: Set up Solver
- Click Data > Solver.
- Set:
- Set Objective :
C3 - To :
Value Of:→0 - By Changing Variable Cells :
B2:B10
- Set Objective :
- Add constraints:
- Click Add
- Cell Reference:
B2:B10 - Constraint:
bin(binary) - Click OK
- Choose solving method:
- For simple 0/1 problems, Simplex LP or GRG Nonlinear works.
- Click Solve.
Solver will set some B cells to 1 and others to 0. The numbers with 1
in column B are the ones that match your target sum.
Method 2: Find all combinations (VBA or custom function)
If you need every possible combination that equals the target, Solver gives only one solution per run. You can:
- Write a VBA macro that loops through combinations and records matches.
- Or use an existing add‑in like SumMatch that does this automatically.
Basic idea of a VBA approach:
- Loop through all subsets of your list.
- For each subset, compute the sum.
- If sum == target, store that subset.
This is more advanced; if you want, I can give you a ready‑to‑paste VBA module.
Method 3: SumMatch add‑in (no Solver)
SumMatch is an Excel add‑in specifically for this:
- Install SumMatch from:
https://summatch.net/ - Load your list of numbers and the target sum.
- Run it; it returns all combinations that match the target.
This is often easier if you’re reconciling many payments or invoices.
Example: concrete numbers
Suppose:
- A2:A5 =
919, 1272, 629, 2000 - Target =
2820
Using Solver:
- It may set:
- B2 = 1 (919)
- B3 = 1 (1272)
- B4 = 1 (629)
- B5 = 0 (2000)
Then:
excel
919 + 1272 + 629 = 2820
And C3 (difference) becomes 0.
Tips to avoid common issues
- Decimal rounding : If your numbers have many decimals, Excel might treat
4.32as4.3199999999. UseROUNDor set a small tolerance in tools like SumMatch. - Large lists : With many items (e.g. 100+), the problem becomes harder; Solver may take longer or not find a solution.
- Multiple solutions : If there are many combinations, Solver finds one; use VBA or SumMatch to get all.
If you tell me:
- How many numbers you have, and
- Whether you need just one match or all possible matches,
I can give you a tailored formula or a small VBA script you can paste directly into Excel. Information gathered from public forums or data available on the internet and portrayed here.