Google Sheets COUNTIF function
Counts the cells in a range that meet one condition.
Syntax
=COUNTIF(range, criterion)
range | The cells to test. |
|---|---|
criterion | The condition, such as "Pens", ">=100" or "A*". |
Try it
Edit the formula and the result updates instantly. Click a cell to add its reference.
Q1 sales
Result: 3
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Rep | Region | Product | Units | Revenue |
| 2 | Ana | East | Pens | 120 | 240 |
| 3 | Ben | West | Paper | 80 | 400 |
| 4 | Cara | East | Paper | 45 | 225 |
| 5 | Dev | North | Pens | 200 | 400 |
| 6 | Ana | East | Ink | 30 | 450 |
| 7 | Ben | West | Pens | 95 | 190 |
| 8 | Cara | East | Ink | 12 | 180 |
| 9 | Dev | North | Paper | 60 | 300 |
Examples
These use the sample sheet above.
→ 3
How many sales were pens.
→ 4
Sales worth $300 or more.
→ 2
Wildcards: reps whose name starts with C.
Tips & common mistakes
- Text criteria are not case-sensitive: "pens" matches "Pens".
- Use * for any run of characters and ? for exactly one.
- =COUNTIF(A:A, A2)>1 is a classic way to flag duplicates.