Skip to content
Blog/Excel
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.

Do this with AI

Try Griddy free

Start in your browser. Also works with Excel and Google Sheets.

By Justin Freels//4 min read

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

Criteria edge cases to check

COUNTIF criteria are text expressions even when they contain operators. Use ">1000" for a fixed threshold and ">"&H2 when the threshold is stored in another cell. For dates, compare against a real date value, such as =COUNTIF(E2:E100,">="&DATE(2026,1,1)), instead of relying on a date-looking text string.

COUNTIF is not case-sensitive and ignores differences in capitalization. It can still miss values with leading or trailing spaces, nonprinting characters, or inconsistent labels. Clean the source column or use a controlled dropdown when the field drives reporting. If the question has multiple conditions, use COUNTIFS and make sure each criteria range covers the same rows.

For duplicate review, =COUNTIF($A$2:$A2,A2) gives each occurrence a running count. Treat values above 1 as duplicates only after deciding whether blank rows, punctuation, and case variants should be considered the same record.

Make the result explainable

Put the criterion in a labeled input cell when a manager may change it, then reference that cell in the formula. Keep a nearby note that says whether the count is case-insensitive, whether wildcards are allowed, and which rows are included. This makes a summary easier to audit than a hardcoded formula copied across several dashboard cards. When a count feeds a KPI, compare it with a filtered detail view at least once during setup.

Sources

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.

Do this with AI

Turn the instructions into a finished spreadsheet.

Tell Griddy what you need in plain English, then inspect and keep editing the result in the browser, Excel, or Google Sheets.

Try Griddy freeStart in your browser. No download required.
Also works withExcel 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