Syntax
=COUNTIF(range, criterion)
range- The cells to test.
criterion- The condition: a value ("West"), a comparison in quotes (">1500"), a wildcard pattern ("M*"), or a cell reference.
COUNTIF counts the cells in a range that meet one condition: how many orders came from the West, how many scores are above 80, how many emails end in gmail.com.
=COUNTIF(range, criterion)
rangecriterionHow many orders came from the West region? Answer in E2.
Tip: while typing a formula, click a cell or drag across cells to insert references. Press Enter to check, and Tab to accept a function suggestion.
Each example below runs against this sample sheet. The results are calculated by the same engine as the practice grid.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Rep | Region | Product | Units | Revenue |
| 2 | Ava | West | Monitor | 12 | $2,400.00 |
| 3 | Liam | East | Keyboard | 30 | $1,500.00 |
| 4 | Maya | West | Mouse | 45 | $900.00 |
| 5 | Noah | North | Monitor | 8 | $1,600.00 |
| 6 | Zara | East | Monitor | 15 | $3,000.00 |
| 7 | Omar | West | Keyboard | 22 | $1,100.00 |
| Formula | Result | What it shows |
|---|---|---|
=COUNTIF(B2:B7, "West") | 3 | Matching is not case-sensitive. |
=COUNTIF(E2:E7, ">1500") | 3 | Comparison operators go inside the quotes. |
=COUNTIF(C2:C7, "M*") | 4 | * matches any characters: products starting with M. |
=COUNTIF(B2:B7, "<>West") | 3 | <> means "not equal to". |
Learning step by step? COUNTIF is covered in Lesson 11: COUNTIF Function of the free course.