Available in:All versions (Works in Excel 2007, every later version, Microsoft 365 and Excel for the web)Examples need Excel 2021 or laterCategory:Math

SUMIF

SOM.ALS in Dutch Excel

Adds the numbers in a range for the rows where one other range meets a single condition.

Difficulty rating 2 of 5. One condition on one range is quick to learn; the third argument's position and criteria written as text with an operator are what readers get wrong.

Last updated: 13 October 2026

See the worked examples

Sheet excerpt: F2 holds the formula
RowABCDEF
1SupplierInvoicedSupplierSmit Groothandel
2Smit Groothandel€4,200.00€ 4.200,00Total€7,975.00€ 7.975,00=SUMIF(A2:A7, F1, B2:B7)=SUMIF(A2:A7; F1; B2:B7)
3Van Dijk Transport€1,850.00€ 1.850,00
4Smit Groothandel€2,650.00€ 2.650,00
5Koolhoven Staal€7,300.00€ 7.300,00
6Smit Groothandel€1,125.00€ 1.125,00
7Van Dijk Transport€960.00€ 960,00
Formula cell (F2)Input

Result: €7,975.00€ 7.975,00

=SUMIF(A2:A7, F1, B2:B7)
=SUMIF(A2:A7; F1; B2:B7)

What SUMIF does and when to use it

What it does: it adds up the rows that meet one criterion, for example all purchases from one supplier.

When to use it: when one condition decides which rows count: a subtotal per account, per supplier or above an amount. It does a filter plus SUM in one cell and stays current. With a second condition, use SUMIFS.

How Excel evaluates it

Excel works through the data in three steps:

  • it builds the test from criteria: a value without an operator means 'equal to', and text such as ">25000" is split into an operator and a value
  • it walks through range from the first cell to the last and marks every cell that passes the test
  • it takes, for each marked cell, the cell at the same position in sum_range (or the cell itself, when sum_range is left out) and adds its number; text and blank cells in the added range are skipped

If no cell passes, the result is 0, not an error.

Watch out: Write the operator inside the quotes and join the cell with &, as in {q}>{q}&E1. With ">E1" in one pair of quotes SUMIF compares with the text E1 and returns 0 without any error.

Mental model

Think of a ledger with a sticky note on the rows you care about: the condition decides where the notes go, and the total is the sum of what sits on the noted rows.

Terms used on this page: criteria, operator, range, cell

SUMIF(range, criteria, [sum_range])
SUMIF(range; criteria; [sum_range])
Arguments
ArgumentTypeMeaningDefault
rangeRequiredThe cells the condition is tested against.
criteriaRequiredThe condition: a value, a cell, or text such as ">100" or "MEM-*".
sum_rangeOptionalThe cells to add; left out means range itself.range

Return value:A number: the total of the cells that meet the criterion

Formulas use commas (,) between arguments, as in English Excel. Formulas use semicolons (;) between arguments, as in Dutch Excel. Formulas use commas (,) between arguments, as in English Excel; Dutch Excel uses semicolons (;).

Worked examples

Beginner

Total purchases from one supplier

You are preparing a supplier confirmation for Veldhuis Installatie BV. The purchase ledger lists every invoice per supplier, and you want the total invoiced by one supplier to compare with their statement. Type the supplier name in F1 and the total appears in F2.

Sheet excerpt: F2 holds the formula
RowABCDEFG
1SupplierInvoicedSupplierSmit Groothandel
2Smit Groothandel€4,200.00€ 4.200,00Total€7,975.00€ 7.975,00=SUMIF(A2:A7, F1, B2:B7)=SUMIF(A2:A7; F1; B2:B7)
3Van Dijk Transport€1,850.00€ 1.850,00
4Smit Groothandel€2,650.00€ 2.650,00
5Koolhoven Staal€7,300.00€ 7.300,00
6Smit Groothandel€1,125.00€ 1.125,00
7Van Dijk Transport€960.00€ 960,00
8
Formula cell (F2)Input

Formula in F2

=SUMIF(A2:A7, F1, B2:B7)
=SUMIF(A2:A7; F1; B2:B7)

Result: €7,975.00€ 7.975,00

Step by step
  1. F1 holds Smit Groothandel. Excel uses it as the criterion; a value without an operator means 'equal to'.
  2. Excel walks down A2:A7:

    • A2 is Smit Groothandel: a match
    • A3 is Van Dijk Transport: no match
    • A4 is Smit Groothandel: a match
    • A5 is Koolhoven Staal: no match
    • A6 is Smit Groothandel: a match
    • A7 is Van Dijk Transport: no match
  3. The matches sit in the 1st, 3rd and 5th cell of A2:A7. Excel takes the 1st, 3rd and 5th cell of B2:B7: B2 = 4,2004.200, B4 = 2,6502.650 and B6 = 1,1251.125.
  4. Excel adds them: 4,2004.200 + 2,6502.650 + 1,1251.125 = 7,9757.975. That is the result in F2.
  5. Type Van Dijk Transport in F1 and the matches are the 2nd and 6th rows: 1,8501.850 + 960 = 2,8102.810. The formula follows the cell.

Watch out: SUMIF compares the whole cell. A supplier booked as Smit Groothandel B.V. is not counted and no error warns you. Scan the supplier column for spelling variants before you trust the total.

More on this example: why it works, 1 variation

Why it works

range and sum_range have the same height and are linked by position: the 3rd cell of A2:A7 belongs to the 3rd cell of B2:B7. The criterion decides which positions count, and only those amounts are added.

Variations

=SUMIF(A2:A7, "Smit*", B2:B7)
=SUMIF(A2:A7; "Smit*"; B2:B7)

A wildcard catches spelling variants that start the same way; use it only when you know no other supplier starts with those letters.

Intermediate

Invoices above the testing threshold

The audit plan says every purchase invoice above 25,00025.000 is tested individually. You want to know how much of the purchase list that covers. The list holds a credit note and an invoice of exactly 25,00025.000, and you can change the threshold in E1 without touching the formula.

Sheet excerpt: E2 holds the formula
RowABCDEF
1Invoice no.AmountThreshold2500025000
2F-25-0412€4,200.00€ 4.200,00Above threshold€59,150.00€ 59.150,00=SUMIF(B2:B8, ">"&E1)=SUMIF(B2:B8; ">"&E1)
3F-25-0413€18,500.00€ 18.500,00
4F-25-0414€25,000.00€ 25.000,00
5F-25-0415-€3,100.00€ -3.100,00
6F-25-0416€31,750.00€ 31.750,00
7F-25-0417€9,800.00€ 9.800,00
8F-25-0418€27,400.00€ 27.400,00
9
Formula cell (E2)Input

Formula in E2

=SUMIF(B2:B8, ">"&E1)
=SUMIF(B2:B8; ">"&E1)

Result: €59,150.00€ 59.150,00

Step by step
  1. The criterion is built first. E1 holds 25000, so ">"&E1 becomes the text ">25000". Excel reads it as the operator > and the value 25000.
  2. sum_range is left out, so B2:B8 serves as both the range that is tested and the range that is added.
  3. Excel tests B2:B8 one cell at a time:

    • 4,2004.200: no
    • 18,50018.500: no
    • 25,00025.000: no, because it is equal to the threshold and not greater
    • -3,1003.100: no
    • 31,75031.750: yes
    • 9,8009.800: no
    • 27,40027.400: yes
  4. Excel adds the two cells that passed: 31,75031.750 + 27,40027.400 = 59,15059.150.
  5. Change the operator to ">=" and the 25,00025.000 invoice joins: 25,00025.000 + 31,75031.750 + 27,40027.400 = 84,15084.150. Whether the boundary invoice is in the test population is a decision, and this is where it is made.

Watch out: Writing ">E1" inside one pair of quotes compares with the text E1 and returns 0 without any error. If a total of 0 surprises you, look at the quotes first.

More on this example: why it works, 1 more pitfall, 2 variations

Why it works

Without sum_range, SUMIF tests and adds the same cells, which is what you want when the condition is about the amount itself. Joining the threshold cell to the operator with & keeps the number live: the criterion is rebuilt whenever E1 changes.

More to watch out for

  • Amounts stored as text never pass a numeric test like ">25000", so they are silently left out. Compare the count of numbers in B2:B8 with the count of rows.

Variations

=SUMIF(B2:B8, ">="&E1)
=SUMIF(B2:B8; ">="&E1)

Use this when an invoice equal to the threshold belongs in the tested population.

=SUMIF(B2:B8, "<0")
=SUMIF(B2:B8; "<0")

A fixed criterion with no cell reference: the total of the credit notes, here -3,1003.100.

Advanced

Share of expense claims that mention a keyword

You review the expense claims of the sales team of Veldhuis Installatie BV and want to know what share of the total went on taxis. Descriptions are free text: some start with Taxi, one has it in the middle. You type the keyword in E1 and the sheet gives a percentage you can compare with last year.

Sheet excerpt: E2 holds the formula
RowABCDEF
1DescriptionAmountKeywordtaxi
2Taxi Schiphol€85.00€ 85,00Share of total25%25%=SUMIF(A2:A9, "*"&E1&"*", B2:B9) / SUM(B2:B9)=SUMIF(A2:A9; "*"&E1&"*"; B2:B9) / SUM(B2:B9)
3Train tickets Rotterdam€210.00€ 210,00
4Taxi Eindhoven€120.00€ 120,00
5Hotel, 3 nights€780.00€ 780,00
6Taxi Amsterdam€95.00€ 95,00
7Client lunch€165.00€ 165,00
8Airport taxi transfer€150.00€ 150,00
9Parking, month€195.00€ 195,00
10
Formula cell (E2)Input

Formula in E2

=SUMIF(A2:A9, "*"&E1&"*", B2:B9) / SUM(B2:B9)
=SUMIF(A2:A9; "*"&E1&"*"; B2:B9) / SUM(B2:B9)

Result: 25%25%

Step by step
  1. The criterion is built first. E1 holds taxi, so "*"&E1&"*" becomes the pattern *taxi*: any text with taxi anywhere in it, in any combination of capitals.
  2. SUMIF tests A2:A9 against the pattern. The cells that match are A2 (Taxi Schiphol), A4 (Taxi Eindhoven), A6 (Taxi Amsterdam) and A8 (the airport taxi transfer). The train tickets, hotel, lunch and parking rows do not contain the word.
  3. For those rows Excel takes the amounts at the same positions in B2:B9: 85, 120, 95 and 150. They add up to 450.
  4. SUM(B2:B9) adds every claim: 85 + 210 + 120 + 780 + 95 + 165 + 150 + 195 = 1,8001.800.
  5. The division comes last: 450 / 1,8001.800 = 0.25, shown as 25% when the cell has a percentage format.
  6. Type hotel in E1 and the pattern *hotel* matches only A5: 780 / 1,8001.800 = 0.4333, shown as 43%.

Watch out: A keyword that is too short matches more than you mean. The keyword tax would also pick up every description that contains taxi, taxes or syntax, and the percentage rises with no sign that anything is off. Look at the matching rows before you report the figure.

More on this example: why it works, 1 more pitfall, 2 variations

Why it works

The asterisks turn an 'equal to' test into a 'contains' test, and SUMIF compares text without regard to case. Dividing by the SUM of the same rows gives a share that stays consistent, because numerator and denominator come from the same range.

More to watch out for

  • A keyword that itself contains * or ? is read as a wildcard. To search for a literal question mark, put ~ in front of it (~?). An empty E1 turns the pattern into **, which matches every text cell and gives 100%.

Variations

=SUMIF(A2:A9, "*"&TRIM(E1)&"*", B2:B9) / SUM(B2:B9)
=SUMIF(A2:A9; "*"&TRIM(E1)&"*"; B2:B9) / SUM(B2:B9)

TRIM removes a space typed after the keyword. Without it, taxi (with a trailing space) would miss the rows where taxi is the last word.

=SUMIF(A2:A9, "<>*"&E1&"*", B2:B9)
=SUMIF(A2:A9; "<>*"&E1&"*"; B2:B9)

The total of everything that does not contain the keyword: 1,3501.350.

MasterExcel 2021 or later (This example needs Excel 2021 or later)

Coverage of a debtors confirmation sample

For the debtors confirmation of Veldhuis Installatie BV you picked two customers from the open items list. The partner asks what share of the total debtors balance the sample covers.

The names of the selected customers sit in E2:E4, typed by hand, and one customer appears twice. One formula should give the share, in a form the colleague who checks your work can read without tracing three helper columns.

Sheet excerpt: F2 holds the formula
RowABCDEFG
1CustomerOpen amountSelected customersCoverage
2Jansen Bouwmaterialen BV€14,250.00€ 14.250,00Raman Logistics BV60%60%=LET( customers, A2:A9, balances, B2:B9, sample, UNIQUE(E2:E4), total, SUM(balances), covered, SUM(SUMIF(customers, sample, balances)), IF(total = 0, 0, covered / total) )=LET( customers; A2:A9; balances; B2:B9; sample; UNIQUE(E2:E4); total; SUM(balances); covered; SUM(SUMIF(customers; sample; balances)); IF(total = 0; 0; covered / total) )
3Yilmaz Metaalwaren BV€8,900.00€ 8.900,00Jansen Bouwmaterialen BV
4Jansen Bouwmaterialen BV€6,750.00€ 6.750,00Raman Logistics BV
5Raman Logistics BV€21,400.00€ 21.400,00
6Bakker Techniek BV€7,400.00€ 7.400,00
7Yilmaz Metaalwaren BV€12,100.00€ 12.100,00
8Peeters Kantoorinrichting BV€5,200.00€ 5.200,00
9Raman Logistics BV€8,000.00€ 8.000,00
10
Formula cell (F2)InputNote: E2:E4 is the hand-typed sample; Raman Logistics BV appears twice on purpose.

Formula in F2

=LET(
  customers, A2:A9,
  balances, B2:B9,
  sample, UNIQUE(E2:E4),
  total, SUM(balances),
  covered, SUM(SUMIF(customers, sample, balances)),
  IF(total = 0, 0, covered / total)
)
=LET(
  customers; A2:A9;
  balances; B2:B9;
  sample; UNIQUE(E2:E4);
  total; SUM(balances);
  covered; SUM(SUMIF(customers; sample; balances));
  IF(total = 0; 0; covered / total)
)

Result: 60%60%

Step by step
  1. LET names the pieces: customers is A2:A9 and balances is B2:B9. sample is UNIQUE(E2:E4): E2:E4 holds Raman Logistics BV, Jansen Bouwmaterialen BV and Raman Logistics BV again, and UNIQUE keeps the first of each, so sample is the two names Raman and Jansen.
  2. total is SUM(balances). The whole list adds up to 14,25014.250 + 8,9008.900 + 6,7506.750 + 21,40021.400 + 7,4007.400 + 12,10012.100 + 5,2005.200 + 8,0008.000 = 84,00084.000. LET calculates this once and the formula uses it twice, in the zero guard and in the division.
  3. covered starts with SUMIF(customers, sample, balances). The criterion is a range of two cells, so SUMIF runs twice and returns two totals as an array.
  4. First criterion, Raman Logistics BV: it matches the 4th and 8th rows, 21,40021.400 + 8,0008.000 = 29,40029.400. Second criterion, Jansen Bouwmaterialen BV: it matches the 1st and 3rd rows, 14,25014.250 + 6,7506.750 = 21,00021.000. The array is {29,40029.400; 21,00021.000}, and the outer SUM makes covered 50,40050.400.
  5. IF checks total = 0, which is not the case (total is 84,00084.000), so it takes the last argument: 50,40050.400 / 84,00084.000 = 0.6, shown as 60%. With an empty ledger the guard would return 0 instead of #DIV/0!.
  6. Without UNIQUE, sample would hold Raman twice and covered would be 29,40029.400 + 21,00021.000 + 29,40029.400 = 79,80079.800. The coverage would read 79,80079.800 / 84,00084.000 = 95% instead of 60%, and nothing would warn you.

Watch out: The opposite mistake: take UNIQUE away and the duplicate Raman in E4 is counted twice, so the coverage reads 95% instead of 60% with no error. UNIQUE only removes exact repeats (it ignores case), so names that differ by a trailing space or a spelling are still two items: clean the list with TRIM first.

More on this example: why it works, 2 more pitfalls, 2 variations

Why it works

When the criterion is a range, SUMIF is evaluated once per cell of that range and returns an array, which the outer SUM collapses. UNIQUE cleans the hand-typed sample first, so no customer is counted twice. LET earns its place by naming total, which is used twice (in the zero guard and in the division), and by keeping the cleaned sample in one place.

Do not use this construction when a second condition is involved (use SUMIFS) or when you need a total for every customer in the book (a PivotTable does that in one pass).

LET and UNIQUE need Excel 2021 or Microsoft 365; the SUMPRODUCT variation works in older versions.

More to watch out for

  • Shift balances by one row (B3:B10 against A2:A9) and SUMIF still returns a figure: every customer is paired with the next row's amount. LET makes this visible, because both ranges are defined next to each other.
  • On a large ledger the cost grows with the sample size times the number of lines: 500 selected customers against 200,000200.000 open items is 100 million comparisons, and the workbook slows down. For a sample that big, summarize the ledger once per customer first.

Variations

=SUMPRODUCT(ISNUMBER(MATCH(A2:A9, E2:E4, 0)) * B2:B9) / SUM(B2:B9)
=SUMPRODUCT(ISNUMBER(MATCH(A2:A9; E2:E4; 0)) * B2:B9) / SUM(B2:B9)

Counts each ledger line once even if a customer appears twice in the sample, with no UNIQUE and no LET, so it also works in older Excel versions. The ledger lines are tested against the sample list, not the other way round.

=SUMIF(A2:A9, E2, B2:B9)
=SUMIF(A2:A9; E2; B2:B9)

One customer at a time, for a balance per customer next to the sample list.

Try it yourself

Type a criterion for the supplier and see which invoices SUMIF adds up.

Sheet excerpt: E2 holds the formula
RowABCDE
1SupplierInvoiced
2Smit Groothandel€4,200.00€ 4.200,00Total€7,975.00€ 7.975,00=SUMIF(A2:A9, "x", B2:B9)=SUMIF(A2:A9; "x"; B2:B9)
3Van Dijk Transport€1,850.00€ 1.850,00
4Smit Groothandel€2,650.00€ 2.650,00
5Koolhoven Staal€7,300.00€ 7.300,00
6Smit Groothandel€1,125.00€ 1.125,00
7Van Dijk Transport€960.00€ 960,00
8Van Rijn Logistiek€3,400.00€ 3.400,00
9€530.00€ 530,00
Formula cell (E2)
  • Formula cell
  • Meets the criterion

=SUMIF(A2:A9, "Smit Groothandel", B2:B9)
=SUMIF(A2:A9; "Smit Groothandel"; B2:B9)

Result: €7,975.00€ 7.975,00

Common mistakes

Common mistakes
SymptomCauseFix
Total is 0 and Excel shows no errorThe total is 0 although several rows clearly pass the test, and Excel shows no error.Check the quotes in the criterion first. Everything inside one pair of quotes is read as text, so the cell reference belongs outside them and the operator inside.
Each row paired with the wrong amountsum_range starts one row lower than range (B3:B10 against A2:A9). There is no error, but every row is paired with the amount below it.Select both ranges over the same rows, for example A2:A9 and B2:B9, and check the first and last pair.
Total too low: amounts are textThe amounts were imported as text (they are left-aligned or show a green triangle), so SUMIF skips them and the total is too low or 0.Convert the column to numbers first, for example with VALUE or Text to Columns, and compare the result with a COUNT of the column.
0 or missing rows for a supplier nameThe criterion is text with a trailing space, or the list holds 'Smit Groothandel' while you type 'Smit Groothandel BV'. SUMIF compares the whole cell, so the total is 0 or misses rows.Clean the keys with TRIM, or use a wildcard on purpose: "Smit*" matches both spellings.

Used in combinations

  • Journal entries where debit does not equal creditList the entries whose debit and credit totals differ: take the unique entry numbers, total debit and credit per entry with SUMIFS, and keep the unequal ones with FILTER over HSTACK, all named in one LET.Excel 2024 or later (This combination needs Excel 2024 or later)
  • Mini trial balance from journal lines with HSTACK, UNIQUE and SUMIFSBuild a list of accounts with their net postings from raw journal lines: UNIQUE gives the accounts, SUMIFS totals each one, HSTACK puts both side by side and SORT orders them.Excel 2024 or later (This combination needs Excel 2024 or later)