COUNTIF
Counts the number of cells within a range that meet a single condition. Great for counting specific values or matching criteria.
COUNTIF(range, criteria)Arguments
rangeThe range of cells to countcriteriaThe condition that determines which cells to count
=COUNTIF(A1:A10,">5")Counts cells with values greater than 5
=COUNTIF(B1:B10,"Yes")Counts cells containing the text 'Yes'
=COUNTIF(A:A,A1)Counts how many times the value in A1 appears in column A
- •Use wildcards: * for any characters, ? for single character
- •For multiple conditions, use COUNTIFS instead
- •Criteria is not case-sensitive for text
- •Skipping the quotes around text or operators - COUNTIF(A:A,Yes) fails, COUNTIF(A:A,"Yes") works
- •Trying to sneak two conditions into one COUNTIF. It only takes a single range/criteria pair, no matter how you phrase it
- •Getting 0 back and assuming the formula is broken, when really the numbers you're counting are stored as text
What is the difference between COUNTIF and COUNTIFS?
COUNTIF takes exactly one range/criteria pair. COUNTIFS takes several, and only counts a row when every single one of them matches.
Can COUNTIF count cells by their fill color?
No, and this trips up a lot of people. COUNTIF only reads values, never formatting. Counting by color means a helper column or a bit of VBA.
Why does COUNTIF return 0 even though I can see matching cells?
Nine times out of ten it's one of three things: hidden leading/trailing spaces, numbers stored as text instead of real numbers, or an operator like ">=" typed outside the quotes.
Need to translate a formula using COUNTIF?
Use our translator to convert your complete formula
