Formula Guide

The Excel COUNTIF Function
explained simply

COUNTIF counts cells matching a condition. Here is the complete guide — syntax, 6 real examples, COUNTIFS, common mistakes and FAQ.

ExcelPro · 6 min read · Updated June 2026
Contents
  1. What does COUNTIF do?
  2. Syntax
  3. 6 real examples
  4. COUNTIFS — multiple conditions
  5. COUNT vs COUNTA vs COUNTIF
  6. Common mistakes
  7. FAQ

What does COUNTIF do?

COUNTIF counts the number of cells in a range that meet a condition you set. It answers questions like: how many sales were above target? How many employees are in one department? How many responses were "Yes"?

It is one of the most useful formulas for data analysis — giving you instant counts from large datasets without filtering or scrolling through rows manually.

Syntax

=COUNTIF(range, criteria)
ArgumentDescription
range requiredThe range of cells to count. This is the column you want to check.
criteria requiredThe condition a cell must meet to be counted. Text goes in quotes; numbers and cell references do not.

6 real examples

Example 1
Count cells matching a text value
=COUNTIF(A2:A100, "North")

Counts every cell in column A that contains exactly "North". Case insensitive — "north" and "NORTH" both count.

Example 2
Count values above a number
=COUNTIF(B2:B100, ">1000")

Counts how many values in column B exceed 1,000. Use comparison operators inside quotes for numeric criteria.

Example 3
Count using a cell reference
=COUNTIF(A2:A100, E1)

E1 contains the value to count. Change E1 and the count updates automatically — making this a dynamic, reusable formula.

Example 4
Count non-empty cells
=COUNTIF(A2:A100, "<>"")

<>"" means "not equal to empty". This counts every cell that has any content — same result as COUNTA.

Example 5
Wildcard count — contains a word
=COUNTIF(A2:A100, "*manager*")

Counts any cell containing the word "manager" anywhere — "Sales Manager", "HR Manager", "Account Manager" all match.

Example 6
Count duplicate entries
=COUNTIF($A$2:$A$100, A2)

For each row, counts how many times that row's value appears in the entire column. Copy this formula down — any row showing 2 or more is a duplicate.

COUNTIFS — count with multiple conditions

COUNTIFS counts rows where every condition is true simultaneously.

=COUNTIFS(range1, criteria1, range2, criteria2, ...)
COUNTIFS Example
Count female employees in the London office
=COUNTIFS(A2:A100, "Female", B2:B100, "London")

Both conditions must be true for a row to be counted. Add more range/criteria pairs for additional filters.

COUNT vs COUNTA vs COUNTIF — which to use?

FormulaWhat it counts
COUNTCells containing numbers only. Ignores text and empty cells.
COUNTAAll non-empty cells — numbers, text, dates, everything.
COUNTIFCells meeting a specific condition you define.
COUNTIFSCells meeting multiple conditions simultaneously.
COUNTBLANKEmpty cells only.

Common mistakes

⚠️ Forgetting quotes around text and operators

=COUNTIF(A:A,North) errors because North has no quotes. Text criteria need quotes: "North". Similarly ">1000" needs quotes but cell references like E1 do not.

⚠️ Mixing criteria syntax

To combine a comparison operator with a cell reference, use & to join them: =COUNTIF(B:B,">"&E1). You cannot write =COUNTIF(B:B,>E1).

⚠️ Case sensitivity

COUNTIF is not case sensitive. "North", "NORTH" and "north" all match the same cells. If you need case-sensitive counting, use SUMPRODUCT with EXACT.

FAQ

Can COUNTIF count dates?
Yes. Use comparison operators: =COUNTIF(A:A,">"&DATE(2026,1,1)) counts dates after 1 January 2026. Or reference a cell containing a date: =COUNTIF(A:A,">"&E1).
Why does COUNTIF return 0 when I know there are matches?
Common causes: extra spaces in data (use TRIM), different capitalisation (shouldn't matter — COUNTIF is case insensitive), or the value is stored as a number but you're searching for text (or vice versa).
Can COUNTIF count across multiple ranges?
Not in one COUNTIF. Add multiple COUNTIFs together: =COUNTIF(A:A,"North")+COUNTIF(C:C,"North"). Or use COUNTIFS with multiple criteria ranges.
What is the difference between COUNTIF and SUMIF?
COUNTIF counts how many cells match your condition. SUMIF adds up the values in a corresponding column for the matching rows. Same logic, different output — count vs sum.

Practise COUNTIF with real data

ExcelPro has COUNTIF and COUNTIFS exercises across every track — free to start, no download needed.

Try COUNTIF exercises →

Related formulas

SUMIF SUMIFS AVERAGEIF SUM IF MAXIFS