Free COUNTIF practice
COUNTIF practice exercises
COUNTIF counts the cells in a range that meet a single condition. 5 reps, from easy to hard, each checked in a real spreadsheet engine. 2 free, 3 with Pro.
=COUNTIF(range, criteria)
COUNTIF guide
How to use COUNTIF in Excel
COUNTIF counts the cells in a range that meet one condition: how many tickets are open, how many orders are over 100, how many names start with A. It's one of the first functions most Excel tests ask for.
For more than one condition at once, use COUNTIFS, which works the same way with extra range and criteria pairs.
Syntax
=COUNTIF(range, criteria)
| Argument | What it is |
|---|---|
range | The cells to check, such as B2:B7. |
criteria | What to count: text in quotes ("Open"), a cell (E2), a comparison in quotes (">4", or ">"&E2 to use a cell), or a wildcard ("*late*"). |
Examples
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Ticket | Status | Hours | Open tickets | |
| 2 | T-1 | Open | 3 | 3 | |
| 3 | T-2 | Closed | 5 | ||
| 4 | T-3 | Open | 8 | ||
| 5 | T-4 | Pending | 2 | ||
| 6 | T-5 | Closed | 12 | ||
| 7 | T-6 | Open | 1 |
=COUNTIF(B2:B7,"Open") returns 3.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Ticket | Status | Hours | Over 4 hours | |
| 2 | T-1 | Open | 3 | 3 | |
| 3 | T-2 | Closed | 5 | ||
| 4 | T-3 | Open | 8 | ||
| 5 | T-4 | Pending | 2 | ||
| 6 | T-5 | Closed | 12 | ||
| 7 | T-6 | Open | 1 |
=COUNTIF(C2:C7,">4") returns 3.
"<>Closed" means not equal to Closed, so Open and Pending tickets both count.| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Ticket | Status | Hours | Not closed | |
| 2 | T-1 | Open | 3 | 4 | |
| 3 | T-2 | Closed | 5 | ||
| 4 | T-3 | Open | 8 | ||
| 5 | T-4 | Pending | 2 | ||
| 6 | T-5 | Closed | 12 | ||
| 7 | T-6 | Open | 1 |
=COUNTIF(B2:B7,"<>Closed") returns 4.
Common mistakes
Counting text with COUNT
COUNT only counts cells that contain numbers, so it returns 0 for a column of text. Use COUNTIF with a condition, or COUNTA to count every non-empty cell.
Wrong=COUNT(B2:B7) → 0
Right=COUNTIF(B2:B7,"Open") → 3
An extra space in the criteria
"Open " with a trailing space doesn't match Open. Check the criteria (and the data) for stray spaces; TRIM removes them from data.
Wrong=COUNTIF(B2:B7,"Open ") → 0
Right=COUNTIF(B2:B7,"Open") → 3
COUNTIF questions
Is COUNTIF case-sensitive?
No. "open", "Open" and "OPEN" all match the same cells.
How do I count cells that contain a word?
Use wildcards: =COUNTIF(B2:B7,"*late*") counts cells that contain late anywhere in the text.
How do I count with two conditions?
Use COUNTIFS: =COUNTIFS(B2:B7,"Open",C2:C7,">4") counts open tickets that took more than 4 hours.
How do I count empty cells?
=COUNTIF(B2:B7,"") counts blank cells, and =COUNTIF(B2:B7,"<>") counts cells that aren't blank.
Related functions
Reading is the warm-up
The reps are what make it stick. Try COUNTIF in the practice sheet above.