COUNTIF & COUNTIFS

COUNTIF counts cells that meet one condition. COUNTIFS handles multiple conditions at once. The fastest way to answer how many of these match that across any list, log, or report.

Math & StatsBeginner
Purpose
Count the cells that match a condition. COUNTIF for one condition, COUNTIFS for two or more.
Returns
A whole number: how many cells matched
Syntax
=COUNTIF(range, criteria)
Excel version
COUNTIF since Excel 2003. COUNTIFS since Excel 2007.

How COUNTIF & COUNTIFS works

COUNTIF walks down a column, checks each cell against your condition, and adds 1 to a tally for every match. The condition can be a value, a comparison wrapped in quotes, or a wildcard pattern.

COUNTIFS is the multi-condition cousin. You list pairs of (range, criteria) and Excel only counts rows where every condition is true. It's AND, never OR.

Both are read-only operations: they answer questions about your data, they never modify it. Pair them with SUMIF for total spend by category and COUNTIF for transaction count by category and you have a working dashboard.

= COUNTIF(range, criteria)

Arguments

COUNTIF
ArgumentTypeRequiredDescription
rangerange✓ RequiredThe column or block of cells to check. Often a whole-column reference like B:B so newly added rows are included automatically.
criteriaany✓ RequiredThe condition. Literal value ("Active"), comparison wrapped in quotes (">100"), wildcard pattern ("J*"), or a cell reference (E2). Use & to splice in a cell value: ">"&E2.
COUNTIFS
ArgumentTypeRequiredDescription
criteria_range1range✓ RequiredThe first column to check.
criteria1any✓ RequiredThe first condition (same shape as COUNTIF).
criteria_range2, criteria2, ...pairs✗ OptionalAdditional (range, criteria) pairs. Up to 127 pairs. All conditions must be true for a row to count (AND logic).

COUNTIF basic: count active employees

You're an HR analyst. Leadership needs a single number: how many people on the roster are currently active. The Status column has values like Active, On Leave, Terminated. One COUNTIF turns the answer in.

=COUNTIF(B:B,"Active")
  • B:B -> the Status column
  • "Active" -> the value to count
  • Whole-column reference -> lets the formula keep working as new hires get added
  • Returns -> an integer: the count of matching rows
E2
fx
=COUNTIF(B:B,"Active")
ABCDEF
1EmployeeStatusActive countResult
2Sarah ChenActiveActive employees6
3James MillerActive
4Maria SantosOn Leave
5David BrownActive
6Emma DavisTerminated
7Alex KimActive
8Carlos GomezOn Leave
9Jenny LiuActive
10Mark ReillyActive
11Rachel WoodTerminated
Formula entered in cell E2.
Six rows match Active. Two are On Leave, two Terminated. The result lookup answer is 6 - one COUNTIF call against ten rows.

COUNTIF with a comparison: how many sales over $1,000

Same pattern as SUMIF: wrap a comparison operator in quotes and COUNTIF tallies the matching numeric cells. Useful for any 'how many of X cleared the bar' question.

=COUNTIF(B:B,">1000")
  • B:B -> the column of sale amounts
  • ">1000" -> the comparison, in quotes
  • Operators -> use >, <, >=, <=, =, <> all wrapped in quotes
  • Dynamic compare -> =COUNTIF(B:B,">"&E2) compares against the value in E2
E2
fx
=COUNTIF(B:B,">1000")
ABCDEF
1OrderAmountCount > $1,000Result
2PO-1001$450Sales over $1,0005
3PO-1002$2,400
4PO-1003$890
5PO-1004$3,150
6PO-1005$1,250
7PO-1006$700
8PO-1007$5,020
9PO-1008$320
10PO-1009$2,000
11PO-1010$580
Formula entered in cell E2.
Five orders cleared the $1,000 bar. The other five were below. COUNTIF returned 5.

COUNTIF with wildcards: count by name pattern

The * wildcard matches any sequence of characters; ? matches exactly one. Useful for tallying entries by prefix, suffix, or partial match.

=COUNTIF(A:A,"J*")
  • A:A -> the Name column
  • "J*" -> matches any name starting with J
  • Other patterns -> "*Smith" matches anything ending in Smith. "*log*" matches any name containing log.
  • Numbers -> wildcards only work on text. Use comparison operators for numeric ranges.
D2
fx
=COUNTIF(A:A,"J*")
ABCDE
1NameNames starting with JResult
2Sarah ChenMatch "J*"4
3James Miller
4Maria Santos
5Jenny Liu
6David Brown
7Jacob Wright
8Emma Davis
9Jordan Hayes
10Carlos Gomez
11Mark Reilly
Formula entered in cell D2.
Four names start with J: James, Jenny, Jacob, Jordan. The * matches whatever follows the J, including the rest of the first name and any spaces / surnames.
Wildcards are case-insensitive: J* matches both James and james. Wrap a literal asterisk in tilde (~*) if your data contains asterisks you don't want treated as wildcards.

COUNTIFS: count by department AND status

Real reports stack conditions. The CFO doesn't want all employees, she wants Active employees in Engineering. COUNTIFS handles that with a (range, criteria) pair for each condition - all must be true for a row to count.

=COUNTIFS(B:B,"Engineering",C:C,"Active")
  • B:B, "Engineering" -> first condition: Department equals Engineering
  • C:C, "Active" -> second condition: Status equals Active
  • Pair pattern -> every additional condition is another (range, criteria) pair
  • AND, not OR -> COUNTIFS only counts rows where every condition is true
F2
fx
=COUNTIFS(B:B,"Engineering",C:C,"Active")
ABCDEFG
1EmployeeDepartmentStatusActive engineersResult
2Sarah ChenEngineeringActiveEng + Active4
3James MillerEngineeringActive
4Maria SantosMarketingActive
5David BrownEngineeringOn Leave
6Emma DavisSalesActive
7Alex KimEngineeringActive
8Carlos GomezOperationsActive
9Jenny LiuMarketingActive
10Mark ReillyEngineeringTerminated
11Rachel WoodEngineeringActive
Formula entered in cell F2.
Six rows are in Engineering: Sarah, James, David, Alex, Mark, Rachel. Two of them fall out on the Status check - David is On Leave, Mark is Terminated. The remaining four (Sarah, James, Alex, Rachel) meet both conditions, so COUNTIFS returns 4.

COUNTIFS combining comparisons and literals

COUNTIFS pairs can mix types. Count orders that are both 'large enough' (over $1,000) and from a specific region. One pair uses a comparison, the other an exact match.

=COUNTIFS(A:A,"North",B:B,">1000")
  • A:A, "North" -> first pair: Region equals North
  • B:B, ">1000" -> second pair: Amount strictly greater than 1000
  • Both must hold -> COUNTIFS counts rows where every pair matches
  • Order doesn't matter -> swap the pairs and you get the same answer
E2
fx
=COUNTIFS(A:A,"North",B:B,">1000")
ABCDEF
1RegionAmountNorth > $1,000Result
2North$450North + over $1k4
3North$2,400
4South$890
5North$3,150
6East$5,020
7North$1,250
8South$2,000
9North$700
10West$4,000
11North$1,800
Formula entered in cell E2.
Six rows are tagged North (rows 2, 3, 5, 7, 9, 11). Four of those clear the $1,000 bar: $2,400, $3,150, $1,250, $1,800. The other two North rows are $450 and $700, both under. COUNTIFS returns 4.
Two-condition COUNTIFS is the workhorse of any cohort analysis. Active customers who spent over $X. Tickets in the last 30 days from a specific team. Whatever 'how many of these match those' question you have, COUNTIFS answers it.

Where people go wrong

  1. Forgetting quotes around comparison operators

    Writing =COUNTIF(B:B,>1000) without the quotes returns #NAME? because Excel can't parse a bare comparison operator. Quotes are mandatory for criteria with operators.

    Fix: Always wrap operator-based criteria in quotes: ">1000", "<>0", "<="&E2 (with ampersand to splice cell values).
  2. Wildcards on numeric data

    Using =COUNTIF(B:B,"1*") to count numbers starting with 1 returns 0. Wildcards only work on text. Excel stores numbers as numbers, not as digit strings.

    Fix: For numeric ranges use comparisons: =COUNTIF(B:B,">=10") AND =COUNTIF(B:B,"<20") combined, or COUNTIFS with both bounds. For text-formatted numbers, fix the format at the source.
  3. Mismatched range sizes in COUNTIFS

    Writing =COUNTIFS(B2:B100,'X',C2:C50,'Y') errors with #VALUE! because the two criteria ranges aren't the same shape. COUNTIFS requires every criteria range to have the same dimensions.

    Fix: Use whole columns (B:B, C:C) when you can. They auto-grow with new data and there's no chance of mismatch.
  4. Counting blanks vs empty strings

    =COUNTIF(B:B,"") counts true blanks AND cells holding the empty string "". The two look identical on screen but Excel treats them differently for some operations.

    Fix: Use COUNTBLANK for actual empty cells. For non-blank counts, use COUNTIF with criteria "<>"

Notes

  • COUNTIF was introduced in Excel 2003. COUNTIFS arrived in Excel 2007. Both work in every modern version.
  • Wildcards: * matches any sequence of characters, ? matches exactly one character. Escape with ~ to match a literal asterisk or question mark.
  • Comparison operators in criteria must be wrapped in quotes: ">100", "<>0", ">="&E2 to splice a cell value.
  • Both functions are case-insensitive: "active" matches "Active" and "ACTIVE".
  • Empty criteria string ("") matches blank cells. Use "<>" to match every non-blank cell.
  • When no rows match, both functions return 0 (not an error).
  • COUNTIFS is AND logic - all conditions must hold. For OR logic, sum two COUNTIF results or use SUMPRODUCT.

Now prove it

Reading about COUNTIFS is one thing.

Writing one in front of an HR director who needs to know how many active engineers are eligible for the promotion review by lunch is completely different.

These exercises put you in real workplace scenarios where one well-structured COUNTIFS saves the morning.

Start practicing →

Here's the thing about COUNTIFS.

You can read this page twice and still freeze when leadership drops a 30,000-row roster on your desk and asks how many people are eligible for the comp adjustment, before the 4pm board prep.

That gap, between knowing what COUNTIFS does and being able to write one cleanly under pressure, is exactly what CellSkill is built to close.

Not with more reading.

With practice on scenarios that look like your actual job.

Start practicing COUNTIFS for free →
Free account . No credit card . Cancel anytime
Practice COUNTIF & COUNTIFS
COUNTIF & COUNTIFS in Excel: Count Rows by Condition · CellSkill