What is the COUNTIF function?
=COUNTIF(range, criteria)COUNTIF counts how many cells in a range meet one condition: how many orders came from Seoul, how many scores are 80 or more, how many cells are blank.
It counts cells, not values. To add values instead, use SUMIF.
Arguments
- range
- The cells to check and count.
- criteria
- The condition. Type a value such as "Seoul", a comparison such as ">=20" or "<>Seoul", or a wildcard pattern such as "B*" (* for any characters, ? for one character). Text and comparisons go in double quotes. Use "" to count blank cells and "<>" to count non-blank cells.
COUNTIF examples
Example 1. Count one product
=COUNTIF(B2:B9, "Apple")Apple appears in 3 rows, so the result is 3.
Example 2. Count quantities of 20 or more
=COUNTIF(C2:C9, ">=20")30, 20, 40 and 25 match, so the result is 4.
Example 3. Find duplicates
=COUNTIF($B$2:$B$9, B2)>1Copied down, this is TRUE for every product that appears more than once.
Common mistakes
Comparison without quotes
Write ">=20" in quotes. To compare with a cell, join them: ">="&F2.
Hidden spaces
"Apple " with a trailing space is not counted as "Apple".
FAQ
- How do I count with two conditions?
- Use COUNTIFS, which counts rows where every condition is TRUE.