COUNTIF answers one question: how many cells in this range meet this condition? It sounds small until you have 4,000 invoice rows and someone asks how many are still unpaid.
This is the short version of a longer guide on my blog, with the parts people actually get wrong.
The syntax
=COUNTIF(range, criteria) -
rangeis the cells to check. -
criteriais a number, a text string, a cell reference, or an expression like">100".
Criteria in quotes when it contains an operator. =COUNTIF(B2:B500,"Paid") counts text. =COUNTIF(C2:C500,">100") counts numbers above 100. =COUNTIF(A:A,D2) counts whatever is in D2, which is how you build a small summary table without retyping.
Five things people use it for
Count a word in a column. =COUNTIF(B:B,"Paid").
Count blanks. =COUNTIF(A2:A100,""). Non-blanks: =COUNTIF(A2:A100,"<>").
Count above a threshold. =COUNTIF(C2:C500,">250").
Count dates in a month. =COUNTIF(D2:D500,">="&DATE(2026,11,1))-COUNTIF(D2:D500,">="&DATE(2026,12,1)). The & joins the operator to the date.
Count duplicates of one value. =COUNTIF(A:A,A2) next to each row, then filter anything above 1.
Wildcards
? matches one character, * matches any number of them.
=COUNTIF(A2:A100,"excel*") counts entries starting with "excel". =COUNTIF(A2:A100,"*report*") counts entries containing "report" anywhere.
Wildcards only work on text. If the range holds numbers, * matches nothing and you get 0.
Why COUNTIF returns 0 when you can see the matches
Three causes, in the order I check them:
- Numbers stored as text. The cell shows
1200but it is text. COUNTIF treats it as a different value from the number 1200. Fix with Data, Text to Columns, or=COUNTIF(range,"*"&criteria&"*")if you only need a rough count. - Hidden spaces.
"Paid "is not"Paid".=COUNTIF(A:A,"Paid")misses it. Clean with TRIM, or count both:=COUNTIF(A:A,"Paid")+COUNTIF(A:A,"Paid "). - Criteria not in quotes.
=COUNTIF(A:A,>100)is an error;=COUNTIF(A:A,">100")is not.
More than one condition
That is COUNTIFS, and it takes pairs:
=COUNTIFS(B:B,"Paid",C:C,">250") Counts rows where column B says Paid and column C is above 250. Each range must be the same size, or Excel returns an error rather than a wrong answer.
The version I use most
A small summary block on the side of the sheet: labels in one column, one COUNTIF per label, ranges locked with $. It survives new rows, it needs no pivot refresh, and anyone can read it.
The full guide, with eight worked examples and a practice file, is on my blog: Excel COUNTIF function.
