SUMIF function
Learn how to use SUMIF in Excel — it adds only the numbers that meet one condition, the workhorse behind every regional total, category subtotal, and 'sum if greater than' question in job interviews. Here are the 3 arguments, the criteria quoting rules, and the SUMIFS order trap.
SUMIF Syntax & The 3 Arguments
SUMIF (conditional sum) checks each cell in range against criteria, then adds the matching numbers from sum_range — filtering and summing in a single formula.
The range to test against criteria (e.g. the region column A2:A7). SUMIF evaluates every cell here.
The condition: text needs quotes ("North"), numbers don't (100), comparison operators are quoted strings (">100"), joinable with cells (">" & D1), wildcards allowed ("North*").
The actual numbers to add (e.g. sales in B2:B7). Omit it and SUMIF sums range itself (e.g. summing B2:B20 where values exceed 100).
Excel SUMIF example
Column A lists regions and column B lists sales. This SUMIF example totals only the North rows.
| Region | Sales |
|---|---|
| North | 1200 |
| South | 800 |
| North | 950 |
| East | 600 |
| North | 400 |
SUMIF checks A2:A6 for North and adds the matching sales in B2:B6: 1200 + 950 + 400 = 2550. Text criteria stay in quotes.
SUMIFS example
The same sheet adds a product column. This SUMIFS example totals North sales of Widgets only — two conditions, and the sum range comes first.
| Region | Product | Sales |
|---|---|---|
| North | Widgets | 1200 |
| South | Widgets | 800 |
| North | Gadgets | 950 |
| North | Widgets | 400 |
SUMIFS adds C2:C5 only where the region is North and the product is Widgets: 1200 + 400 = 1600. Put the sum range first. Reversing it into SUMIF order returns 0 instead of an error.
Six ways people actually use SUMIF
One ledger, six questions. Every formula below runs on the same table (A2:D7: region, rep, product, amount).
| Region | Rep | Product | Amount |
|---|---|---|---|
| North | Ana Li | Widgets | 1250 |
| South | Ben Kim | Widgets | 800 |
| North | Chen Wu | Gadgets | 960 |
| East | Dana Ortiz | Widgets | 600 |
| North | ·Ana Li | Gadgets | 330 |
| West | Eve Novak | Widgets | 700 |
Case 2 keeps its threshold in G2 (= 900); everything else reads the table directly. · marks a leading space inside the cell.
1. Sum only the amounts above a threshold
The third argument is omitted, so SUMIF adds the cells in the criteria range itself: 1250 + 960 + 800 + 700 = 3710. 600 is left out — > is strictly greater.
2. Keep the threshold in a cell
G2 = 900, so only the two largest rows count: 1250 + 960 = 2210. The pattern is operator + & + cell, which lets the threshold change without touching the formula.
3. Match by prefix or substring
Gad* catches Gadgets: 960 + 330 = 1290. Use ? for exactly one character and ~* when you mean a literal asterisk.
4. Catch the rows whose key has a stray space
1580 = 1250 + 330: both Ana Li rows count. The exact criteria "Ana Li" would have missed the row with the leading space and returned 1250 — the number one cause of a total that comes out short.
5. Pick several values from one column (OR)
3140 = North's 1250 + 960 + 330 plus East's 600. The array constant {"North","East"} is the single-column version of 'in this list'; the outer SUM adds the pieces.
6. Total the top N rows
LARGE(range,4) is the 4th largest amount (700). Strictly greater than it keeps exactly the top three: 1250 + 960 + 800 = 3010. For any N, replace 4 with N+1.
Practice this pattern →SUM vs SUMIF vs SUMIFS vs SUBTOTAL: which one to use
Pick the function from the question, not from habit: no condition → SUM, one condition → SUMIF, two or more conditions → SUMIFS, and "only the rows my filter left visible" → SUBTOTAL.
| What you want | Function | Formula |
|---|---|---|
| Add a whole range | SUM | =SUM(B2:B6) |
| Add only the cells that meet one condition | SUMIF | =SUMIF(A2:A6, "North", B2:B6) |
| Add cells that meet two or more conditions | SUMIFS | =SUMIFS(C2:C5, A2:A5, "North", B2:B5, "Widgets") |
| Add only the rows visible after filtering | SUBTOTAL | =SUBTOTAL(109, B2:B6) |
Conditional sum with OR or custom logic | SUMPRODUCT | =SUMPRODUCT((A2:A6="North")*B2:B6) |
SUBTOTAL with 109 skips rows hidden by a filter; SUM keeps them. If a filtered report still totals the hidden rows, SUM is why.
Try it live: total a column in the grid
No condition to write? The sum-column tool runs a sample column you can filter and re-range, then hands you the =SUM or =SUBTOTAL formula to copy.
How to write SUMIF criteria (operators, wildcards, cell references)
The criteria argument is a small expression, not always plain text: numbers stand alone, text needs quotes, a comparison operator is quoted as one whole string, and a cell reference is joined to the operator with & — ">"&D1, never >"&D1.
| Criteria | Written as | Meaning |
|---|---|---|
| Exactly 100 | 100 | Numbers need no quotes |
| 100 or more | ">=100" | Operators are quoted |
| Not North | "<>North" | <> means not equal |
| Starts with North | "North*" | * is any run of characters, including none |
| Contains North | "*North*" | Put * on both sides |
| Greater than the value in D1 | ">"&D1 | Join operator and cell with & |
| Blank cells | "" | An empty pair of quotes |
Add only sales above the amount in D1 (sum range omitted)
Omit the third argument and SUMIF adds the cells in the first range itself — exactly what "sum only the values above X" needs. Two caveats nobody warns you about: text like "North" is case-insensitive, and if sum_range is a different size than range Excel silently anchors on sum_range's top-left cell and uses a block the same shape as range (A1:A5 with B1:K5 sums only B1:B5).
SUMIFS with several conditions (AND, OR, and date ranges)
Every "range, criteria" pair you add to SUMIFS has to hold, so the pairs are AND. A date range is the same column twice, once with ">=" and once with "<=".
April 2026 sales
OR needs a different shape: add two SUMIF/SUMIFS results, or hand SUMIF an array constant — =SUM(SUMIF(A2:A6,{"North","East"},B2:B6)) — which is the single-column version of "in this list".
North or East, in one formula
Counting instead of adding? COUNTIF and COUNTIFS take the same criteria syntax without a sum range.
4 Critical SUMIF Gotchas & Pitfalls
1. SUMIFS reverses the argument order (top interview trap)
SUMIF puts criteria first, sum range last. SUMIFS flips it: =SUMIFS(sum_range, range1, criteria1, …). Reversing the order throws no error — it just returns 0 or wrong numbers, which is exactly why interviewers love this question.
2. Criteria quoting rules
Text criteria must be quoted: "North". Numbers don't need quotes: 100. Comparison operators are a text string: ">=100". Writing >100 bare inside the formula is a syntax error.
3. Case-insensitive matching + wildcards over-count
SUMIF matching ignores case (north = North), and "North*" also hits North America and Northwest. If your data contains 'Norten', use exact values or verify with SUMPRODUCT — don't let wildcards silently over-count.
4. The three culprits behind a 0 result
Hidden spaces around the criteria value (fix with TRIM), numbers stored as text in sum_range (fix with VALUE), or misaligned range/sum_range starting points — none of these throw an error, they all just return 0.
Conditional Sum Showdown: SUMIF vs SUMIFS vs SUMPRODUCT
SUMIF
The standard answer for single-condition sums. Shortest syntax, most readable — the first reflex for 'total by region / by category' interview questions.
SUMIFS
The correct tool for two or more conditions. Mnemonic: sum range FIRST, then condition pairs — the opposite of SUMIF. Not available in pre-2007 legacy workbooks.
SUMPRODUCT
The universal fallback. =SUMPRODUCT((A2:A7="North")*B2:B7) achieves conditional sums via boolean arrays, scales to arbitrarily complex logic, and doubles as the weighted-average formula.
Excel vs Google Sheets Features
Microsoft Excel (365 / Desktop)
Excel's SUMIF accepts cross-sheet references: =SUMIF(Sheet2!A:A, "North", Sheet2!B:B). Note the range argument doesn't take array constants — for multi-condition sums switch to SUMIFS or SUMPRODUCT.
Google Sheets
Google Sheets keeps the syntax identical and adds =ARRAYFORMULA(SUMIF(...)) expansion; =QUERY() can also group-and-sum in one formula, but SUMIF/SUMIFS remains the standard answer in interviews.
Recommended Conditional-Sum Challenges
From single-condition SUMIF to multi-condition SUMIFS and SUMPRODUCT weighted averages — build muscle memory in real business scenarios.
FAQ
How does SUMIF work in Excel?
=SUMIF(range, criteria, sum_range) scans range for cells matching criteria and adds the matching cells from sum_range. Example: =SUMIF(A2:A7, "North", B2:B7) totals the sales of the North region.
Why does my SUMIF return 0?
The usual suspects: 1) text criteria without quotes, 2) numbers stored as text in the sum range, 3) invisible spaces around the criteria value (fix with TRIM), 4) sum_range and range pointing at different-sized areas.
What is the difference between SUMIF and SUMIFS?
SUMIF takes one condition; SUMIFS takes two or more. Watch the argument order: SUMIFS puts sum_range FIRST — =SUMIFS(sum_range, range1, criteria1, range2, criteria2) — the exact reverse of SUMIF, and the #1 trap in interview tests.
How do I sum cells greater than a value?
Wrap the operator in quotes: =SUMIF(B2:B20, ">100") adds only the cells above 100. For a threshold stored in a cell, join it: =SUMIF(B2:B20, ">" & D1).
Can I use wildcards in SUMIF?
Yes — * matches any number of characters and ? matches exactly one, so =SUMIF(A2:A20, "North*") sums every region starting with 'North'. Matching is case-insensitive on both Excel and Google Sheets.