Skip to content
getgriddy.ai/blog/excel-countif-function
Excel

COUNTIF in Excel: Formula Examples for Budgets, Status, and Duplicates

Use COUNTIF in Excel to count rows by category, status, threshold, duplicate value, or wildcard match. Includes practical formulas and fixes.

·4 min read

Reviewed by Griddy

Updated for current Excel and Google Sheets workflows, with examples chosen to map back to real spreadsheet tasks rather than abstract formula syntax.

COUNTIF counts how many cells in a range meet one condition. It is the formula behind common review questions like "how many expenses are software?", "how many tasks are overdue?", "how many rows are blank?", or "how many duplicate IDs appeared in this export?".

That makes it useful in live operating sheets like a small business budget, budget tracker, or expense tracker where counts by category or status should update automatically.

The syntax

fx
=COUNTIF(range, criteria)
  • range — the cells to check
  • criteria — what to count for. Can be text, a number, a comparison, a wildcard, or a cell reference

Common use cases

Count by exact text match:

fx
=COUNTIF(A2:A100, "California")

Count numbers meeting a threshold:

fx
=COUNTIF(B2:B100, ">1000")

Count non-blank cells:

fx
=COUNTIF(A2:A100, "<>")

Count cells containing specific text (wildcard):

fx
=COUNTIF(A2:A100, "*Corp*")

The * wildcard matches any sequence of characters. Use ? to match exactly one character.

Count using a cell reference as criteria:

fx
=COUNTIF(A2:A100, D2)

TIP

To count duplicates, use =COUNTIF($A$2:$A2, A2) with an expanding range. Any result greater than 1 is a duplicate. See the remove duplicates guide for the full pattern.

COUNTIF is case-insensitive

"apple", "Apple", and "APPLE" all count as the same. If case matters, use EXACT inside SUMPRODUCT:

fx
=SUMPRODUCT((EXACT(A2:A100, "Apple"))*1)

Multiple conditions: COUNTIFS

COUNTIF only handles one condition. For two or more, use COUNTIFS:

fx
=COUNTIFS(A2:A100, "California", B2:B100, ">1000")

COUNTIFS uses the same pattern as SUMIFS — alternate between range and criteria pairs.

Common mistakes

MistakeWhat happensFix
Forgetting quotes around text#NAME? errorWrap text in quotes: "California"
Forgetting quotes around operatorsCounts wrongUse ">1000" not >1000
Using = instead of "" for blanksMisses some blanksUse "" for blanks, "<>" for non-blanks

The Griddy way

COUNTIF is easy for simple counts but awkward for partial matches, case sensitivity, or OR logic across multiple columns. Just ask:

"Count how many rows have 'Corp' anywhere in the company name and a deal value over $5,000"

Griddy writes the formula and applies it — no manual syntax construction.

Skip the manual work

Describe it. Griddy does it.

Instead of writing this formula yourself, just tell Griddy what you need in plain English. Works in Excel and Google Sheets.

Use this on real templates

Use COUNTIF on live finance sheets

COUNTIF shows up constantly in budgeting and expense review when you need fast counts by category, status, or threshold.

Finance