How to use the COUNTIF function
✓ Verified in LibreOffice 25.8.7.3Count how many cells meet a condition — how many times a value appears, how many pass a threshold.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel | =COUNTIF(A2:A10,"East") | COUNTIF(range, criteria). Comparisons and wildcards go in the quoted criteria. |
| Google Sheets | =COUNTIF(A2:A10,"East") | Identical. |
| LibreOffice Calc | =COUNTIF(A2:A10,"East") | Identical. |
How it works
COUNTIF takes just two things: the range to look through (A2:A5) and the criteria to count ("East") — here it finds "East" three times. The criteria is flexible: a number, exact text, a comparison in quotes (">100" counts values over 100), or wildcards ("E*" counts anything starting with E, "?at" matches cat/bat/hat). Two everyday uses: flag duplicates with =COUNTIF(range,cell)>1, and check membership with =COUNTIF(list,value)>0. For more than one condition use COUNTIFS, and to count blanks or non-blanks use COUNTBLANK or COUNTA.
Verified, not just documented
We ran =COUNTIF(A2:A5,"East") in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 3 — exactly the expected result. Every formula here is confirmed by actually executing it.