Back to Blog
Conditional Aggregation
Excel
SUMIFS
COUNTIFS
Formulas

SUMIFS and COUNTIFS: Conditional Totals Without the Helper Columns

02/08/2026
SUMIFS and COUNTIFS: Conditional Totals Without the Helper Columns

Quick Summary

Key points from this article

  • ➕ Why SUMIFS beats SUMIF even when you only have one condition
  • 🔗 Stacking two, three or more criteria — and what AND logic really means here
  • 🔢 Operators as criteria: ">=1000", "<>Refunded", and ">="&B1 from a cell
  • 📅 Date ranges that survive regional settings, month-to-date, and rolling windows
  • 🔀 OR logic with array constants, plus when to switch to SUMPRODUCT
  • 📊 AVERAGEIFS, MAXIFS and MINIFS — same grammar, three more answers
Reading time: ~14 min

There is a version of every spreadsheet where someone filters the data, selects the visible rows, reads the status bar, and types the number into a summary tab. It works exactly once. Next week the data grows, and the whole ritual starts over.

SUMIFS and COUNTIFS replace that ritual with a formula that answers the same question every time the data changes: how much, and how many, under these conditions. This guide covers the syntax everyone gets backwards, the criteria tricks that aren't obvious, and the failure modes that quietly return zero.

Tip: Follow along with your own data. Every example below works on any table with a few text columns, a date column and a number column.


1) The Family, and Why SUMIF Is a Trap

There are two generations of conditional aggregation in Excel, and mixing them is the single most common source of confusion.

The old generation — one condition only:

=SUMIF(range, criteria, [sum_range])
=COUNTIF(range, criteria)

The new generation — one or more conditions:

=SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)
=COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2], ...)

Read those two SUM variants again and look at where the numbers you're adding sit:

FunctionWhere the numbers goOptional?
SUMIFLast argumentYes — omit it and it sums the criteria range
SUMIFSFirst argumentNo — always required

That reversal is deliberate on Microsoft's part (SUMIFS needs a fixed first argument so the criteria pairs can repeat), and it catches everyone. A SUMIF habit rewritten as SUMIFS without moving the sum range returns a wrong number rather than an error, because both arguments are valid ranges.

The recommendation is simple: use SUMIFS and COUNTIFS always, even for one condition. You get the same answer, you never have to remember which generation you're in, and adding a second condition later is an edit instead of a rewrite.

The full family, all sharing the SUMIFS argument order:

FunctionAnswers
SUMIFSTotal of matching rows
COUNTIFSNumber of matching rows
AVERAGEIFSMean of matching rows
MAXIFS / MINIFSLargest / smallest matching value

COUNTIFS is the odd one out only because there's nothing to aggregate — it starts straight at the first criteria pair.

Sales Log for Conditional Totals

One row per transaction, six columns of conditions to slice by. Every formula in this article runs on this table — data lives in A2:F9, with Amount in column E.

ABCDEF
1
Date
Region
Rep
Product
Amount
Status
2
2026-01-12
North
Alice
Laptop
2400
Paid
3
2026-01-28
South
Bruno
Monitor
640
Paid
4
2026-02-04
North
Alice
Monitor
320
Pending
5
2026-02-17
East
Chen
Laptop
3600
Paid
6
2026-02-28
South
Bruno
Keyboard
150
Refunded
7
2026-03-09
North
Dana
Laptop
1200
Paid
8
2026-03-21
East
Chen
Monitor
960
Pending
9
2026-03-30
South
Dana
Keyboard
300
Paid

fxCells with formulas are highlighted in green

Hover over formula cells to see the formula and highlight referenced cells


2) Your First SUMIFS

🎯 Scenario: You need total sales for the North region.

Data Setup:

  • Column A: Date
  • Column B: Region
  • Column C: Rep
  • Column D: Product
  • Column E: Amount
  • Column F: Status
=SUMIFS(E2:E9, B2:B9, "North")

Result: 3920

Read it out loud in three parts: add up column E, wherever column B says North. That's the whole mental model — one range to add, then pairs of "look here, for this".

The two ranges must be the same shape. E2:E9 and B2:B9 are both 8 rows tall, so row 5 of one lines up with row 5 of the other. Mismatch them and you get #VALUE! — Excel won't guess which rows you meant.

Criteria are not case sensitive. "North", "NORTH" and "north" all match the same rows. That's usually a relief, occasionally a surprise when you genuinely need to tell "IT" from "it".

Pitfall: A SUMIFS that returns 0 is almost never a broken formula — it's a criterion that matched nothing. Before you rewrite anything, test the condition on its own with =COUNTIFS(B2:B9, "North"). If that's 0 too, the problem is your data, not your syntax.

Mini exercise: Total the Amount column for the South region. (You should get 1090.)


3) Stacking Conditions: What AND Really Means

🎯 Scenario: Total sales for the North region that have actually been paid.

Every criteria pair you add narrows the result. Just keep appending them:

=SUMIFS(E2:E9, B2:B9, "North", F2:F9, "Paid")

Result: 3600

A third condition follows the same pattern:

=SUMIFS(E2:E9, B2:B9, "South", F2:F9, "Paid", D2:D9, "Keyboard")

Result: 300

The conditions combine with AND — a row must satisfy all of them to be counted. This is the part people misread. "Sales in North and South" is not a SUMIFS with two Region criteria; a single cell cannot say North and South at once, so that formula returns 0. That's an OR question, and section 8 handles it.

Excel allows up to 127 criteria pairs. If you're anywhere near that, the sheet is telling you it wants a Pivot Table.

Pitfall: Every criteria range must be the same height as the sum range — all of them, not just the first. =SUMIFS(E2:E9, B2:B9, "North", F2:F8, "Paid") fails on that stray F2:F8. Select ranges by clicking column-to-column rather than dragging, and this stops happening.

Mini exercise: Total the Laptop sales made by Chen. (Expect 3600.)


4) COUNTIFS: Same Grammar, One Fewer Argument

🎯 Scenario: How many orders are still pending, and how many of those are in the North?

COUNTIFS counts rows instead of adding values, so it skips the aggregate range entirely:

=COUNTIFS(F2:F9, "Pending")

Result: 2

=COUNTIFS(F2:F9, "Pending", B2:B9, "North")

Result: 1

Everything you learn about SUMIFS criteria applies to COUNTIFS unchanged — operators, wildcards, cell references, dates. They're the same engine with a different verb.

The pairing that makes reports honest: put the count next to the total. A North total of 3,920 means something very different if it came from one huge order rather than twelve small ones.

=SUMIFS(E2:E9, B2:B9, "North") & " across " & COUNTIFS(B2:B9, "North") & " orders"

Result: 3920 across 3 orders

Pitfall: COUNTIFS counts rows that match, not non-empty cells. If you want "how many cells in this column have anything in them", that's COUNTA. And if a criteria range includes the header row by accident, a text header can silently match a text criterion — start your ranges at row 2.

Mini exercise: Count the orders above 1000 that were paid. (Expect 3.)


5) Criteria That Aren't Just Words

🎯 Scenario: Total everything from 1,000 upwards, and total everything that wasn't refunded.

Criteria aren't limited to exact text. Wrap a comparison operator in quotes and it becomes the condition:

=SUMIFS(E2:E9, E2:E9, ">=1000")

Result: 7200

Note that E2:E9 appears twice — once as the range being summed, once as the range being tested. That's completely legal and very common: "add up the amounts, where the amounts are big".

The operators you get:

CriterionMeaning
">=1000"Greater than or equal to 1000
"<500"Less than 500
"<>Refunded"Anything except "Refunded"
"<>"Any non-empty cell
"="Empty cells only

Excluding a category is often cleaner than listing the ones you want:

=SUMIFS(E2:E9, F2:F9, "<>Refunded")

Result: 9420

Now make it dynamic. Hard-coding 1000 inside quotes means editing formulas to change the threshold. Put the number in a cell and join the operator to it with &:

=SUMIFS(E2:E9, E2:E9, ">="&H1)

With 1000 in H1, that's the same 7200 — but now the threshold is an input, not buried code.

Pitfall: The ampersand is not optional and the quotes go around the operator only. ">=H1" looks for the literal text "greater than or equal to H1" and returns 0. ">="&H1 builds the string ">=1000" at calculation time. Whenever a criterion involves a cell, it needs &.

Mini exercise: Build a formula that totals every order strictly between 500 and 1000, using two criteria on the same column. (Expect 1600.)


6) Date Ranges Without the Guesswork

🎯 Scenario: February's total, from a log that will eventually cover three years.

A date range is just two conditions on the same column — one lower bound, one upper bound:

=SUMIFS(E2:E9, A2:A9, ">="&DATE(2026,2,1), A2:A9, "<="&DATE(2026,2,28))

Result: 4070

Use DATE(year, month, day), not a typed date string. ">=01/02/2026" means 1 February in most of the world and 2 January in the US, and which one your formula gets depends on the machine that opens the file. DATE(2026,2,1) means the same day everywhere.

The month-end problem solves itself with EOMONTH, which knows about 30-day months and leap years:

=SUMIFS(E2:E9, A2:A9, ">="&H1, A2:A9, "<="&EOMONTH(H1,0))

Put any date of the target month in H1 and you have a month selector. EOMONTH(H1,-1) gives the end of the previous month, EOMONTH(H1,1) the end of the next — useful for building a twelve-row report where each row shifts by one.

Rolling windows work the same way, with TODAY() as the anchor:

=SUMIFS(E2:E9, A2:A9, ">="&TODAY()-30, A2:A9, "<="&TODAY())

That's "the last 30 days", recalculated every time the file opens.

Pitfall: This only works if your dates are real dates. A date that was pasted in as text sits left-aligned in its cell and will never satisfy a >= comparison — the formula returns 0 with no error at all. Select the column, check the status bar shows a Sum, and if it doesn't, run the text through DATEVALUE or Text to Columns first.

Mini exercise: Total the first quarter of 2026 — 1 January to 31 March — using DATE on both bounds. (Expect 9570.)


7) Wildcards and Partial Matches

🎯 Scenario: Someone types product names slightly differently every time, and you need all the monitors.

Text criteria accept two wildcards:

WildcardMatches
*Any number of characters, including none
?Exactly one character
=SUMIFS(E2:E9, D2:D9, "M*")

Result: 1920 — every product starting with M.

=COUNTIFS(D2:D9, "*board")

Result: 2 — every product ending in "board".

Surround the term with wildcards on both sides for "contains anywhere":

=COUNTIFS(D2:D9, "*top*")

Result: 3 — Laptop, three times.

Combine with a cell reference for a search box:

=SUMIFS(E2:E9, D2:D9, "*"&H1&"*")

Type any fragment in H1 and the total follows.

Pitfall: Wildcards only apply to text. "*" will not match numbers or dates, so =COUNTIFS(E2:E9, "*") returns 0 on a column of amounts even though every cell is filled. Use "<>" for "any non-empty" instead. And if you need to find a literal asterisk or question mark, escape it with a tilde: "~*".

Mini exercise: Count how many orders were placed for a product containing "Mon", by any rep in the East. (Expect 1.)


8) OR Logic: Two Regions, One Number

🎯 Scenario: A combined total for North and East.

As section 3 established, extra criteria pairs narrow — they never widen. =SUMIFS(E2:E9, B2:B9, "North", B2:B9, "East") asks for rows where the region is simultaneously North and East, and correctly returns 0.

The clean solution is an array constant plus SUM:

=SUM(SUMIFS(E2:E9, B2:B9, {"North","East"}))

Result: 8480

The inner SUMIFS runs once per item in the braces and returns {3920, 4560}; the outer SUM collapses that to one number. Curly braces, commas between items, quotes around text — and this works in every Excel version, no Ctrl+Shift+Enter needed.

To read the list from cells instead of typing it, point at the range:

=SUM(SUMIFS(E2:E9, B2:B9, H1:H2))

Careful with overlap. If your two conditions can both be true for one row, that row gets counted twice. =SUM(SUMIFS(E2:E9, E2:E9, {">=1000",">=500"})) double-counts everything over 1000. Overlapping criteria need SUMPRODUCT instead:

=SUMPRODUCT(((B2:B9="North")+(B2:B9="East")>0)*E2:E9)

Each comparison produces TRUE/FALSE per row, + acts as OR, >0 flattens any double-counting back to a single hit, and multiplying by E2:E9 sums only the surviving rows. It's harder to read, so save it for cases where the array-constant version genuinely can't work.

Pitfall: An array constant uses commas for a horizontal list and semicolons for a vertical one — but on a machine where the list separator is a semicolon, both shift by one. If {"North","East"} throws an error on a colleague's copy, try {"North";"East"}. This is a locale setting, not a bug in your formula.

Mini exercise: Total the sales that are either Pending or Paid, without listing every status. (Hint: "<>Refunded" is one criterion, not two.)


9) The Rest of the Family

🎯 Scenario: The average North order, the biggest laptop sale, and the smallest paid order.

Same argument order, three more questions answered:

=AVERAGEIFS(E2:E9, B2:B9, "North")

Result: 1306.67

=MAXIFS(E2:E9, D2:D9, "Laptop")

Result: 3600

=MINIFS(E2:E9, F2:F9, "Paid")

Result: 300

The one behavioural difference worth knowing:

FunctionWhen nothing matches
SUMIFS0
COUNTIFS0
MAXIFS / MINIFS0
AVERAGEIFS#DIV/0!

AVERAGEIFS errors because dividing by zero rows is genuinely undefined — there's no honest average of nothing. In a report that's noise, so wrap it:

=IFERROR(AVERAGEIFS(E2:E9, B2:B9, H1), "No orders")

Version note: MAXIFS and MINIFS arrived in Excel 2019. On anything older they show up as #NAME?, and the fallback is an array formula — =MAX(IF(D2:D9="Laptop", E2:E9)) confirmed with Ctrl+Shift+Enter.

Pitfall: MAXIFS returning 0 is ambiguous — it means either "nothing matched" or "the largest match really is zero". If that distinction matters, put a COUNTIFS beside it. A count of 0 tells you which situation you're in.

Mini exercise: Find the average order value for orders that weren't refunded, with a friendly message if there are none.


10) Making It Fast and Making It Last

Once these formulas are load-bearing in a real workbook, two things start to matter.

Use structured references. If your data is a real Excel Table (Ctrl+T), the ranges name themselves:

=SUMIFS(Sales[Amount], Sales[Region], H1, Sales[Status], "Paid")

Nothing needs updating when rows are added — the table grows and the formula follows. It also reads like a sentence six months later, which E2:E9 does not.

Be careful with whole-column references. =SUMIFS(E:E, B:B, "North") is tempting and it works, but each one asks Excel to consider a million rows. One is fine. Two hundred of them in a dashboard is the difference between instant and a three-second pause on every keystroke. Prefer a Table; if you must use ranges, bound them generously (E2:E10000) rather than infinitely.

Anchor your ranges before you fill. In a summary block, the data ranges stay put while the criteria move:

=SUMIFS($E$2:$E$9, $B$2:$B$9, $H2, $F$2:$F$9, I$1)

Absolute data ranges, mixed references on the criteria — $H2 keeps the region as you fill right, I$1 keeps the status as you fill down. One formula, dragged across a whole grid.

Know when to stop. SUMIFS is the right tool for a fixed set of questions on a live sheet — the numbers a dashboard needs, the totals a report cites. When you're exploring, and the questions change every few minutes, a Pivot Table gets there faster. Twenty SUMIFS formulas rebuilding what one Pivot Table does is a sign to switch.

Pitfall: Numbers stored as text are the reason a perfectly correct SUMIFS returns 0. Imported amounts arrive as text constantly, and they look identical to real numbers — except they align left and refuse to sum. Check with =COUNT(E2:E9): if that's smaller than =COUNTA(E2:E9), some of your numbers aren't numbers.

Mini exercise: Rebuild the section 3 formula using an Excel Table and structured references.


Quick Checklist (Before You Trust the Number)

  • The sum range is the first argument (you're using SUMIFS, not SUMIF)
  • Every criteria range is the same height as the sum range
  • No range includes the header row
  • Any criterion referencing a cell uses &">="&H1, never ">=H1"
  • Date bounds are built with DATE() or EOMONTH(), not typed as text
  • The dates in your date column are real dates (right-aligned, and COUNT sees them)
  • The amounts in your sum range are real numbers (COUNT matches COUNTA)
  • A result of 0 has been verified with a matching COUNTIFS, not assumed correct
  • Data ranges are absolute (or a Table) before the formula is filled across

Common Pitfalls Summary

  1. SUMIF vs SUMIFS argument order: the sum range moves from last to first. A converted formula that still runs returns a wrong number, not an error.
  2. Returning 0 and calling it done: 0 means "nothing matched". Confirm with COUNTIFS before you believe it.
  3. Mismatched range heights: #VALUE!, every time. Select ranges the same way for every argument.
  4. ">=H1" instead of ">="&H1: the first is literal text and matches nothing.
  5. Typed date criteria: ">=01/02/2026" is ambiguous across locales. Use DATE(2026,2,1).
  6. Text that looks like numbers or dates: comparisons silently fail. COUNT versus COUNTA exposes it.
  7. Expecting OR from stacked criteria: two criteria on one column is AND, which returns 0. Use SUM(SUMIFS(...{"a","b"})).
  8. Overlapping OR criteria: the array-constant trick double-counts rows matching both. Switch to SUMPRODUCT.
  9. Trailing spaces: "North " and "North" are different values. TRIM the source column, not the criterion.
  10. #DIV/0! from AVERAGEIFS: expected when nothing matches. Wrap it in IFERROR.

Conclusion

SUMIFS and COUNTIFS earn their place by turning a manual routine into something that stays true. Filter-and-read gives you a number for today's data; =SUMIFS(Sales[Amount], Sales[Region], "North", Sales[Status], "Paid") gives you a number that's still right after next month's import.

The grammar is short enough to memorise: what to aggregate, then pairs of where-to-look and what-to-look-for. Everything else in this article is a variation on that one line — operators instead of words, DATE() instead of text, braces for OR, a different verb for average or max.

The habit worth keeping is the last one on the checklist. These functions fail quietly: a wrong criterion doesn't throw an error, it returns 0, and a zero in a report looks exactly like a real result. Put a COUNTIFS next to anything important, and you'll always know the difference between "no sales" and "no match".

If you want practice with conditional aggregation, try the exercises in the app — each scenario drills these patterns with real business data.

Share this article:
Back to Blog