COUNTIFS in Excel: Syntax, 5 Examples, COUNT Family Comparison | Sheets & Cells
Function · Math & Statistical

COUNTIFS — Count Rows with Multiple Criteria

The sibling of SUMIFS. Instead of adding up amounts, COUNTIFS counts how many rows meet your filters: how many North-region transactions, how many overdue invoices, how many entries in Q1. Same criteria model as SUMIFS — same wildcards, operators, and date-range patterns — minus the sum_range argument.

Quick answer
COUNTIFS counts rows that meet one or more criteria. Each row is counted only if ALL criteria match (AND logic). Unlike SUMIFS, there's no sum_range — the first argument is your first criteria_range.
Syntax
=COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2, ...])
Working example
=COUNTIFS(Region, "North", Product, "Widget A") → Counts rows where Region = "North" AND Product = "Widget A". Both conditions must match.
✓
Works in every Excel version since 2007
Excel 2007, 2010, 2013, 2016, 2019, 2021, 365, Excel for the web, Google Sheets, LibreOffice, Apple Numbers. Introduced alongside SUMIFS and shares the same criteria model — learn one, get the other.
📗 Free COUNTIFS example workbook
9 sheets · same 24-row sales log as SUMIFS · every pattern demonstrated · includes the COUNT family comparison
Download .xlsx (free) Open in Sheets
Category
Math & Statistical
Difficulty
Beginner → Intermediate
Excel version
2007+
Max criteria
127 pairs
127
Max criteria pairs
5
Worked examples
5
COUNT variants
8/10
Templates using it

Syntax breakdown

COUNTIFS has just four arguments to master. The pattern is identical to SUMIFS — minus the sum_range.

ArgumentTypeWhat it does
criteria_range1 REQUIRED The first column to filter on (Region, Product, Date, etc.). Same size as all other criteria_ranges.
criteria1 REQUIRED Value or expression to match in criteria_range1. Can be text ("North"), a number (100), a cell reference (A2), or a comparison (">100").
criteria_range2 OPTIONAL Second filter column. Add up to 127 range/criteria pairs to layer filters. All must match (AND logic).
criteria2 OPTIONAL Second criteria expression. Any row that fails any criteria is excluded from the count.
The one thing that makes COUNTIFS different from SUMIFS: no sum_range. COUNTIFS doesn't add anything — it just counts. Every other rule (argument order for criteria pairs, wildcards, operators, date-range patterns, AND logic) is identical. If you know one, you know the other.

Five working examples

Every example uses the same 24-row sales log as the SUMIFS workbook. Q1 2026 data — 4 regions, 5 products, 6 salespeople.

01 Basic COUNTIFS — single criterion

Count all transactions in the North region. The simplest possible COUNTIFS.

RegionProductAmount
NorthWidget A$2,499.75
SouthGizmo Pro$8,900.00
NorthBundle X$6,450.00
NorthGizmo Pro$11,570.00
…and 20 more rows
=COUNTIFS(Region, "North")
→ Returns 8 — eight transactions have Region = "North"

Sanity check

Add up all region counts and you should get the total row count (24 transactions). If not, you're either missing a category or double-counting:

North (8) + South (6) + East (5) + West (5) = 24 ✓

02 Multiple criteria — AND logic

Count transactions in North AND for Widget A AND by Emma Thompson.

=COUNTIFS(Region, "North", Product, "Widget A")
→ Returns 2 — Emma's row + Michael's row
=COUNTIFS(Region, "North", Product, "Widget A", Salesperson, "Emma Thompson")
→ Returns 1 — only Emma's row survives all three filters
🔗 Cross-page reconciliation with SUMIFS
On the SUMIFS page, the same "North + Widget A" filter sums to $6,249.60. Divide by the COUNTIFS result — 2 transactions — and you get $3,124.80 average per transaction. That's what AVERAGEIFS returns natively. The three IFS-family functions reconcile perfectly.

Each criteria_range must be the same size. The order of criteria pairs doesn't affect the count — put them in whatever order reads clearest.

03 Date range — count transactions in a window

Count transactions between two dates. Same & concatenation pattern as SUMIFS.

=COUNTIFS(Date, ">="&DATE(2026,1,15), Date, "<="&DATE(2026,2,15))
→ Returns 8 — transactions from Jan 15 to Feb 15 inclusive

Monthly breakdown — a perfectly balanced Q1

=COUNTIFS(Date, ">="&DATE(2026,1,1), Date, "<="&DATE(2026,1,31)) ' → 8 (Jan)
=COUNTIFS(Date, ">="&DATE(2026,2,1), Date, "<="&DATE(2026,2,28)) ' → 8 (Feb)
=COUNTIFS(Date, ">="&DATE(2026,3,1), Date, "<="&DATE(2026,3,31)) ' → 8 (Mar)
The concatenation trick: the & joins the operator string with the actual date. ">="&DATE(2026,1,15) becomes >=Jan 15, 2026. Without &, Excel searches for the literal text ">="&DATE(...) and returns 0.

Self-updating patterns

=COUNTIFS(Date, ">="&EOMONTH(TODAY(),-1)+1, Date, "<="&EOMONTH(TODAY(),0))
→ Count transactions in the CURRENT month, always updating.
=COUNTIFS(Date, ">="&DATE(YEAR(TODAY()),1,1), Date, "<="&TODAY())
→ Year-to-date transaction count for running dashboards.

04 Wildcards — group text patterns

Count all "Widget" variants in one shot without listing each SKU.

PatternMatchesCount
Widget*Widget A + Widget B10
Gizmo*Gizmo Pro + Gizmo Lite9
*Pro*Anything containing "Pro"5
Widget ?"Widget" + exactly 1 character10
=COUNTIFS(Product, "Widget*")
→ Returns 10 — 5 Widget A + 5 Widget B
=COUNTIFS(Product, "Widget*", Region, "North")
→ Wildcards combine with other criteria — Widget-anything sold in North

* matches any characters, ? matches exactly one. Wildcards work only on TEXT criteria_ranges. For numeric ranges, use comparison operators instead (Example 5). To match a literal * or ?, prefix with ~.

05 Comparison operators — thresholds and exclusions

Count transactions above $5,000. Count everyone except one region. Live thresholds from cell references.

=COUNTIFS(Amount, ">5000")
→ Returns 10 — ten transactions above $5,000
=COUNTIFS(Amount, ">=2000", Amount, "<=5000")
→ Returns 8 — between $2,000 and $5,000 (inclusive)
=COUNTIFS(Region, "<>North")
→ Returns 16 — every region EXCEPT North
=COUNTIFS(Amount, ">"&$C$22)
→ Dynamic threshold from cell — put a number in C22, filter updates live
The operator rule: operators (>, <, >=, <=, <>) go INSIDE the criteria string. To combine with a cell reference, use &: ">"&C2. Without the ampersand, Excel searches for the literal text ">C2".

Interactive playground

Try it Live COUNTIFS demonstration

This mirrors the live cells in the workbook. Change the yellow inputs → the blue answer updates.

Input · Region
North
Output · Transaction count
8
=COUNTIFS(CRegion, "North")
Input · Region + Product
North + Gizmo Pro
Output · Filtered count
2
=COUNTIFS(CRegion, $C$24, CProduct, $C$25)

Download the workbook to try dropdowns, date pickers, and threshold sliders.

Common errors and how to fix them

COUNTIFS shares SUMIFS's tendency to return 0 silently when something's wrong. Seven common scenarios:

ResultWhy it happensBroken → Fix
#VALUE! criteria_range1 and criteria_range2 are different sizes (row counts don't match). COUNTIFS(C6:C29, "North", D6:D15, "Widget A") COUNTIFS(C6:C29, "North", D6:D29, "Widget A")
0 (silent) Missing & concatenation when using a cell reference in a comparison. COUNTIFS(Amount, ">C2") COUNTIFS(Amount, ">"&C2)
0 (silent) Trailing spaces in criteria or in the criteria_range data (invisible). COUNTIFS(Region, "North ") COUNTIFS(Region, TRIM("North "))
0 (silent) Text-vs-number mismatch — criteria is text but data is numeric (or vice versa). COUNTIFS(Qty, "100") COUNTIFS(Qty, 100)
#VALUE! Reference to a closed workbook (COUNTIFS cannot read closed external files). COUNTIFS('[Closed.xlsx]Sheet1'!A:A, ...) Open the source workbook, or use SUMPRODUCT
Wrong count Trying to use OR logic in a single COUNTIFS (COUNTIFS is AND-only). COUNTIFS(Region, "North", Region, "South") /* returns 0 */ =COUNTIFS(Region,"North") + COUNTIFS(Region,"South")
Wrong count Wildcards applied to a numeric criteria_range (wildcards only work on text). COUNTIFS(Amount, "1*") COUNTIFS(Amount, ">=1000", Amount, "<2000")
📗 Every example above, in one workbook
Same 24-row log as SUMIFS, live-filter panels, and the COUNT family comparison sheet.
Download countifs-examples-2026.xlsx

The COUNT family — 5 ways to count in Excel

Excel has FIVE distinct counting functions. Beginners confuse them constantly. Here's each one, what it counts, and when to use it — all with real numbers from a sample column of 8 cells (4 numbers, 2 text values, 2 blanks):

Function What it counts Formula Result
COUNT Only NUMBERS. Ignores text, blanks, errors. =COUNT(H2:H9) 4
COUNTA Any NON-EMPTY cell — numbers, text, dates, errors. Everything except truly blank. =COUNTA(H2:H9) 6
COUNTBLANK Only truly EMPTY cells. The inverse of COUNTA. =COUNTBLANK(H2:H9) 2
COUNTIF Single-criterion count. The predecessor of COUNTIFS. =COUNTIF(Region,"North") 8
COUNTIFS Multi-criterion count (up to 127 pairs, AND logic). =COUNTIFS(Region,"North",Product,"Widget A") 2
The decision tree: Just count everything non-empty? → COUNTA. Just count numbers? → COUNT. Detect missing data? → COUNTBLANK. Count with conditions? → COUNTIFS (skip COUNTIF — COUNTIFS is a strict superset with a cleaner argument pattern).

Why COUNTIFS instead of COUNTIF?

COUNTIFS is what SUMIFS is to SUMIF — a strict upgrade. Same behavior for one criterion, but scales cleanly to any number of criteria. Unlike SUMIFS/SUMIF, both COUNTIF and COUNTIFS start with the criteria_range (no argument-order gotcha) — but COUNTIFS is still the future-proof choice.

=COUNTIF(Region, "North") ' → 8
=COUNTIFS(Region, "North") ' → 8 (identical)
=COUNTIFS(Region, "North", Product, "Widget A") ' → 2 (COUNTIF can't do this)

The IFS family — five functions, one pattern

COUNTIFS is one of five functions that share the same criteria model. Learn one, get the rest for free:

Meet the family

Every function below uses the same criteria_range/criteria pattern. Only the aggregation verb changes.

Reconciliation example — same North + Widget A filter across the family:

=SUMIFS(Amount, Region, "North", Product, "Widget A") ' → $6,249.60
=COUNTIFS(Region, "North", Product, "Widget A") ' → 2 transactions
=AVERAGEIFS(Amount, Region, "North", Product, "Widget A") ' → $3,124.80 ($6,249.60 ÷ 2)

SUMIFS, COUNTIFS, and AVERAGEIFS ship with Excel 2007+. MAXIFS and MINIFS require Excel 2019 or 365.

Related functions

Excel version compatibility

COUNTIFS ships with every modern Excel version. If you can use SUMIFS, you can use COUNTIFS:

PlatformSupports COUNTIFS?Notes
Excel 365 (Windows & Mac)✓ YesFull support
Excel 2021✓ YesFull support
Excel 2019 / 2016 / 2013 / 2010 / 2007✓ YesIntroduced in Excel 2007
Excel 2003 and earlier✗ NoUse SUMPRODUCT with boolean arrays
Excel for the web✓ YesFull support
Excel on iPad & iPhone✓ YesFull support
Google Sheets✓ YesSame syntax, same behavior
LibreOffice Calc✓ YesSame syntax, all versions
Apple Numbers✓ YesSame syntax

When to use COUNTIFS vs. alternatives

Use COUNTIFS when…

  • You need to count with one or more conditions. This is 95% of real-world conditional counting.
  • Your data is in an open workbook. Not a closed external file.
  • Speed matters. COUNTIFS is built into Excel's calc engine — much faster than SUMPRODUCT for the same result.

Use COUNTA instead when…

  • You just need the total row count of a list — no filters. =COUNTA(A2:A1000) counts every non-empty cell.

Use COUNTBLANK instead when…

  • You're checking data quality — how many required cells are empty in this range?

Use SUMPRODUCT instead when…

  • You need OR logic across criteria (rows where Region = "North" OR Region = "South").
  • You have calculated criteria (LEFT(Product,6) = "Widget").
  • You need to count from a closed external workbook.
  • You're stuck on Excel 2003 or older.

How COUNTIFS actually works

The algorithm

COUNTIFS walks through each row of your criteria_ranges in parallel. For every row, it checks: do ALL criteria pairs match? If YES, increment the counter. If NO to any criteria, skip. It's pure row-by-row filtering — the simplest possible aggregation.

Because all criteria must match (AND logic), the order of criteria pairs doesn't affect the result. Put your most restrictive criteria first if you care about readability; Excel's optimizer handles the actual evaluation order.

Text criteria — case and whitespace

  • Case-insensitive: "NORTH", "north", and "North" all match the same rows.
  • Wildcards work in exact-match: * for any characters, ? for one, ~ to escape.
  • Whitespace is significant — trailing spaces silently break matches. Wrap in TRIM() if your data comes from external sources.

Numeric criteria — operators inside quotes

  • Operators go INSIDE the criteria string: ">100", not >100.
  • To reference a cell in a comparison, use & to concatenate: ">"&C2.
  • Implicit equality on a number just uses the number: COUNTIFS(Qty, 100).

Date criteria — dates are numbers

Excel stores dates as serial numbers, so date comparisons work exactly like numeric ones. Use DATE() or cell references rather than raw serial numbers for readability:

=COUNTIFS(Date, ">="&DATE(2026,1,1), Date, "<="&DATE(2026,3,31))

The 127-criteria limit

COUNTIFS accepts up to 127 criteria_range/criteria pairs. Realistically nobody uses more than 4-5. If you find yourself approaching double digits, reshape your data and use a PivotTable — it's easier to build and maintain.

Performance notes

COUNTIFS is one of Excel's fastest aggregation functions. Three things affect speed:

  • Range size. Narrow ranges ($A$2:$A$5000) calculate faster than whole-column references ($A:$A). Use whole-column refs only when you truly don't know the row count.
  • Number of criteria pairs. Each additional pair is another comparison per row. Linear scaling — 3 criteria takes about 3× as long as 1 for the same row count.
  • Data-type consistency. Mixed numeric/text data in a criteria_range forces Excel to coerce types on every comparison — measurably slower than clean data.

When to switch to a PivotTable

If you're writing dozens of COUNTIFS to build a summary matrix (count by region × product × month), stop. Build a PivotTable — faster, easier to maintain, refreshes with one click. The rule of thumb: use COUNTIFS in fixed cells within a dashboard; use a PivotTable for exploration.

How to write a COUNTIFS from scratch

  1. Identify the column to filter on

    What's the column with the values you want to check? That's your criteria_range1. Unlike SUMIFS, there's no sum_range to worry about first.

  2. Write the criteria expression

    Simple text or numbers work as-is: "North", 100. Comparisons go in quotes: ">100". Cell references combine with &.

  3. Add more criteria pairs as needed

    Each additional filter is another range/criteria pair. All must match — AND logic. Add up to 127 pairs.

  4. Use the operator + & trick for numeric or date thresholds

    Wrap operators in quotes, combine with cell references using &. For dates: ">="&DATE(2026,1,1).

  5. Sanity-check with a total

    Sum the counts across all categories in a breakdown. They should equal COUNTA() of your log. If not, you're missing a category or double-counting.

Functions used with COUNTIFS

🎁 Grab the free COUNTIFS workbook
Same 24-row sales log as SUMIFS · live-filter panels · COUNT family comparison · common-errors playground.
Download countifs-examples-2026.xlsx

Frequently asked questions

What's the difference between COUNTIF and COUNTIFS?

COUNTIFS accepts multiple criteria (up to 127 pairs), COUNTIF accepts only one. Both start with criteria_range as the first argument — so there's no argument-order gotcha like SUMIF/SUMIFS. Use COUNTIFS by default; it's a strict superset and scales cleanly.

Why is my COUNTIFS returning 0?

Common causes: trailing spaces in criteria or data (use TRIM), text-vs-number mismatch (100 vs "100"), missing & when using a cell reference in a comparison (">C2" instead of ">"&C2), or criteria_range and other criteria_ranges having different sizes.

Can COUNTIFS handle OR logic?

Not directly — COUNTIFS is AND-only. Three workarounds: (1) Add multiple COUNTIFS results: =COUNTIFS(Region,"North") + COUNTIFS(Region,"South"). (2) Use SUMPRODUCT with boolean addition: =SUMPRODUCT((Region="North")+(Region="South")). (3) Add a helper column that flags qualifying rows.

How do I count entries in a date range?

Use two criteria on the same Date column — one with >= for the start, one with <= for the end: =COUNTIFS(Date, ">="&DATE(2026,1,1), Date, "<="&DATE(2026,3,31)). The & is essential.

What's the difference between COUNT, COUNTA, COUNTBLANK, COUNTIF, and COUNTIFS?

COUNT counts only numbers. COUNTA counts every non-empty cell (numbers, text, dates, errors). COUNTBLANK counts empty cells. COUNTIF counts with one criterion. COUNTIFS counts with 1-127 criteria. See the COUNT family comparison table above for details.

Can I use wildcards in COUNTIFS?

Yes, on text criteria_ranges only. * matches any characters, ? matches exactly one. Example: =COUNTIFS(Product, "Widget*") counts all "Widget" products. For numeric ranges, use comparison operators.

How is COUNTIFS different from SUMIFS?

One difference: COUNTIFS has no sum_range. Everything else — criteria pattern, wildcards, comparison operators, date-range handling — is identical. If you know SUMIFS, you know COUNTIFS. Just drop the sum_range argument.

Does COUNTIFS work in Google Sheets?

Yes, with identical syntax and behavior. Formulas port cleanly between Excel and Sheets.

Is COUNTIFS case-sensitive?

No — COUNTIFS is case-insensitive for text comparisons. "NORTH", "north", and "North" all match. For case-sensitive counting, use SUMPRODUCT with EXACT: =SUMPRODUCT(--EXACT(Region, "North")).

Can COUNTIFS pull from a closed workbook?

No — same limitation as SUMIFS. COUNTIFS returns #VALUE! when its ranges reference a closed external workbook. Workarounds: keep the source workbook open, use SUMPRODUCT (which works with closed files), or import the data with Power Query.

How do I count unique values with criteria?

COUNTIFS counts rows, not distinct values. To count uniques matching criteria, use SUMPRODUCT(1/COUNTIFS(...)) as an array trick, or in Excel 365 use =ROWS(UNIQUE(FILTER(Column, Region="North"))). Simpler: build a PivotTable and configure Value Field Settings to Distinct Count.

Which templates use COUNTIFS?

The same 8 of 10 templates that use SUMIFS — because most dashboards count transactions AND sum their amounts together. Budget Tracker, Expense Report, Inventory Tracker, Sales Dashboard, KPI Dashboard, Employee Attendance, Timesheet, and Project Timeline all rely on COUNTIFS for occurrence counts.

Templates that use COUNTIFS

The same 8 templates that use SUMIFS also rely on COUNTIFS for occurrence counting — transactions per category, entries per period, statuses per stage:

Skip the syntax. Ask in plain English.

The Sheets & Cells AI Add-in writes COUNTIFS, SUMIFS, AVERAGEIFS — every criteria pair, every date range — right inside Excel. Type "count Q1 transactions for Widget A in the North region" and get the working formula, ready to paste.

Try the AI Add-in →