COUNTIF counts the cells that meet one condition.
Syntax
=COUNTIF(range, criteria)
Common examples
- Count cells equal to Pending:
=COUNTIF(B2:B100, "Pending") - Count numbers above 50:
=COUNTIF(C2:C100, ">50") - Count cells that contain "tax":
=COUNTIF(A2:A100, "*tax*") - Count blank cells:
=COUNTIF(A2:A100, "") - Count non-blank cells:
=COUNTIF(A2:A100, "<>")
Use a cell as the condition
=COUNTIF(B2:B100, F1) counts whatever is typed in F1.
Count duplicates
Put =COUNTIF($A$2:$A$100, A2) next to each row. Any result above 1 means the value is repeated.
Count unique values
In modern Excel use =COUNTA(UNIQUE(A2:A100)).
Common mistakes
- Forgetting quotes around operators: write
">50", not>50. - Extra spaces in the data, so "Pending " does not match "Pending".
- COUNTIF is not case sensitive.
For two or more conditions, use COUNTIFS.