
The Excel COUNTIF function counts cells in a range that meet one condition. You can count sales above a target, check how often a name occurs, or find blank cells without manually filtering your data.
COUNTIF syntax
=COUNTIF(range, criteria)
range is the set of cells to check; criteria defines what should be counted. Criteria may be a number, text, comparison such as “>500”, a cell reference, or a wildcard pattern.
Example 1: Count matching text
Suppose A2:A8 contains Paid, Pending, Paid, Paid, Cancelled, Pending, Paid. To count Paid orders:
=COUNTIF(A2:A8,"Paid")
Result: 4. COUNTIF ignores letter case when matching text.
Example 2: Count numbers above a target
If B2:B6 holds 250, 800, 450, 1,200 and 900, count values above 500 with:
=COUNTIF(B2:B6,">500")
Result: 3. Comparison operators inside quoted criteria are useful for budget, attendance and performance reports.
Example 3: Compare against a cell
If D2 contains your target of 500, build the condition with an ampersand:
=COUNTIF(B2:B6,">"&D2)
Do not put D2 inside quotation marks; ">D2" would look for literal text rather than use the cell’s value.
Example 4: Count names using wildcards
Count names beginning with Sam (such as Sam and Samantha):
=COUNTIF(A2:A20,"Sam*")
The asterisk (*) matches any number of characters, while the question mark (?) matches exactly one. To find a literal asterisk or question mark, prefix it with a tilde (~).
Example 5: Count nonblank and blank cells
=COUNTIF(C2:C20,"<>")
This counts cells that are not empty according to COUNTIF’s criteria behavior. To count truly empty cells, use =COUNTBLANK(C2:C20). Cells containing formulas that return an empty string can behave differently from physically empty cells, so test on your data.
Example 6: Identify duplicate entries
In B2, use =COUNTIF($A$2:A2,A2) and fill down. A result greater than 1 indicates that the current value has appeared earlier. To count all occurrences of A2 in the full list, use =COUNTIF($A$2:$A$100,A2).
COUNTIF vs COUNTIFS
COUNTIF evaluates one criterion. If you want to count Paid orders from a particular region simultaneously, use COUNTIFS, which accepts multiple range/criteria pairs.
Common COUNTIF mistakes
- Operator without quotation marks: use
">500", not>500as a separate formula argument. - Hard-coded cell references: use
">"&D2for a changing threshold. - Numbers stored as text: inspect your source data if numeric comparisons seem incorrect.
- Dates stored as text: use actual Excel date values for reliable comparisons.
- Wrong separators: some Excel regional settings require semicolons instead of commas.
Frequently asked questions
Is COUNTIF case-sensitive?
No. For case-sensitive matching, use a technique based on EXACT and SUMPRODUCT instead.
Can COUNTIF use multiple criteria?
One criterion per COUNTIF. For multiple conditions, use COUNTIFS.
Can COUNTIF count dates?
Yes. For example, =COUNTIF(A2:A100,">="&DATE(2026,1,1)) counts dates on or after 1 January 2026 if the cells contain actual Excel dates.
Practice exercise
Create a list of ten invoices with a Status column. Count how many are Paid, count invoices over ₹1,000, and use a cell reference to change the amount threshold.
Next lesson: learn SUMIFS for adding values under multiple conditions, or explore Excel Functions (Module 3).
