How to Count Matching Cells With COUNTIF
COUNTIF counts cells in one range that meet one condition. For multiple simultaneous conditions, use COUNTIFS instead.
What to do
- Count an exact word with
=COUNTIF(A2:A100,"Paid"). Text criteria are placed in quotation marks. - Count values above a threshold with
=COUNTIF(B2:B100,">100"). Join a comparison operator to a cell reference using">"&D2. - Use
*as a wildcard for any number of characters and?for one character, such as=COUNTIF(A2:A100,"INV-*"). - Check the source for leading or trailing spaces if a count is lower than expected.
Checks and limitations
- COUNTIF is not case-sensitive for ordinary text matches.
- A criterion that contains a literal asterisk or question mark requires a tilde escape, such as
"~*".
What COUNTIF does
Use COUNTIF to count cells matching a text label, number, or comparison condition.
Syntax
=COUNTIF(range, criteria)
Copyable formula
=COUNTIF(D2:D5,"Paid")Example result: 3.
Example data
| Item | Region | Sales | Status |
|---|---|---|---|
| Widget | North | 120 | Paid |
| Cable | South | 80 | Paid |
| Widget | North | 200 | Pending |
| Desk | North | 150 | Paid |
Real-world use
Count how many orders have been marked Paid in a status column.
Common mistakes
- Using an ordinary equals comparison for criteria that include an operator; comparison criteria need quotes.
- Expecting COUNTIF to distinguish letter case; regular text matching is not case-sensitive.
Alternative formulas
Use COUNTIFS for multiple conditions. Use COUNTA to count nonblank cells without a condition.
Compatibility
COUNTIF is available in current Excel versions. Wildcards * and ? match text patterns; a tilde escapes a literal wildcard.
Frequently asked questions
Does COUNTIF count blank cells?
Use an empty-string criterion to count blanks, or COUNTBLANK for a direct blank-cell count.
How do I count values greater than a cell value?
Use a criterion such as ">"&F2 so the operator is combined with the cell reference.
Browse the Excel formula library ยท Open the percentage calculator