COUNTIF with a text condition
Step 1 of 3
COUNTIF counts the cells in a range that meet a condition. It takes two things: the range to look in, and what to look for.
Click Continue when you're ready.
Already know it? Type the formula straight into D2.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Order | City | From Copenhagen | |||
| 2 | 1001 | Aarhus | ||||
| 3 | 1002 | Copenhagen | ||||
| 4 | 1003 | Odense | ||||
| 5 | 1004 | Copenhagen | ||||
| 6 | 1005 | Aalborg | ||||
| 7 | 1006 | Aarhus | ||||
| 8 | 1007 | Copenhagen | ||||
| 9 |
Need help?
Why this works
COUNTIF(range, criteria) counts the cells in the range that match. A text criterion matches whole cells and ignores upper and lower case, so "copenhagen" would count the same 3 orders.
Common mistake: Selecting the order numbers in column A instead of the cities. The range must hold the values the condition is checked against.
The answer
- D2
=COUNTIF(1B2:B8,2"Copenhagen")
In plain words: Count the cells 1in B2:B8 that say 2Copenhagen.
Use COUNTIF with the text in quotes, for example =COUNTIF(B2:B8,"Copenhagen"). It is not case-sensitive.
+10 points