---
title: "COUNTIF with a text condition in Google Sheets | PracticeExcel"
description: "In D2, use COUNTIF to count how many orders in B2:B8 came from Copenhagen."
canonical_url: "https://practiceexcelonline.com/sheets/practice/countif/countif-text"
locale: en
meta:
  "og:description": "In D2, use COUNTIF to count how many orders in B2:B8 came from Copenhagen."
  "og:image": "https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_COUNTIF%2Bwith%2Ba%2Btext%2Bcondition%2Bin%2BGoogle%2BSheets%2Cdescription_~SW4gRDIsIHVzZSBDT1VOVElGIHRvIGNvdW50IGhvdyBtYW55IG9yZGVycyBpbiBCMjpCOCBjYW1lIGZyb20gQ29wZW5oYWdlbi4%2Ceyebrow_COUNTIF%2Csite_practiceexcel%2Cprops_eyJncmlkIjp7ImNvbHMiOlsiQSIsIkIiLCJEIl0sInJvd3MiOlt7Im4iOjEsImNlbGxzIjpbIk9yZGVyIiwiQ2l0eSIsIkZyb20gQ29wZW5oYWdlbiJdfSx7Im4iOjIsImNlbGxzIjpbIjEwMDEiLCJBYXJodXMiLCIiXX0seyJuIjozLCJjZWxscyI6WyIxMDAyIiwiQ29wZW5oYWdlbiIsIiJdfSx7Im4iOjQsImNlbGxzIjpbIjEwMDMiLCJPZGVuc2UiLCIiXX0seyJuIjo1LCJjZWxscyI6WyIxMDA0IiwiQ29wZW5oYWdlbiIsIiJdfSx7Im4iOjYsImNlbGxzIjpbIjEwMDUiLCJBYWxib3JnIiwiIl19XSwidGFyZ2V0IjpbMSwyXX19%2Cp_Ii9zaGVldHMvcHJhY3RpY2UvY291bnRpZi9jb3VudGlmLXRleHQi%2Cs_LoeljGBVX-7B0dRs.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "COUNTIF with a text condition in Google Sheets | PracticeExcel"
  "twitter:image": "https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_COUNTIF%2Bwith%2Ba%2Btext%2Bcondition%2Bin%2BGoogle%2BSheets%2Cdescription_~SW4gRDIsIHVzZSBDT1VOVElGIHRvIGNvdW50IGhvdyBtYW55IG9yZGVycyBpbiBCMjpCOCBjYW1lIGZyb20gQ29wZW5oYWdlbi4%2Ceyebrow_COUNTIF%2Csite_practiceexcel%2Cprops_eyJncmlkIjp7ImNvbHMiOlsiQSIsIkIiLCJEIl0sInJvd3MiOlt7Im4iOjEsImNlbGxzIjpbIk9yZGVyIiwiQ2l0eSIsIkZyb20gQ29wZW5oYWdlbiJdfSx7Im4iOjIsImNlbGxzIjpbIjEwMDEiLCJBYXJodXMiLCIiXX0seyJuIjozLCJjZWxscyI6WyIxMDAyIiwiQ29wZW5oYWdlbiIsIiJdfSx7Im4iOjQsImNlbGxzIjpbIjEwMDMiLCJPZGVuc2UiLCIiXX0seyJuIjo1LCJjZWxscyI6WyIxMDA0IiwiQ29wZW5oYWdlbiIsIiJdfSx7Im4iOjYsImNlbGxzIjpbIjEwMDUiLCJBYWxib3JnIiwiIl19XSwidGFyZ2V0IjpbMSwyXX19%2Cp_Ii9zaGVldHMvcHJhY3RpY2UvY291bnRpZi9jb3VudGlmLXRleHQi%2Cs_LoeljGBVX-7B0dRs.png"
---

> Index of every page on this site: [llms.txt](https://practiceexcelonline.com/llms.txt)

# **COUNTIF with a text condition**

1.
2.
3.

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.

D2fx

|  | 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?

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://practiceexcelonline.com/#identity","@type":"Organization","name":"PracticeExcel","url":"https://practiceexcelonline.com/","logo":{"@id":"https://practiceexcelonline.com/#logo"}},{"@id":"https://practiceexcelonline.com/#website","@type":"WebSite","inLanguage":"en-US","name":"PracticeExcel","url":"https://practiceexcelonline.com/","alternateName":["Practice Excel Online","PracticeExcelOnline.com"],"publisher":{"@id":"https://practiceexcelonline.com/#identity"},"workTranslation":{"@id":"https://excelopgaver.dk/#website"}},{"@id":"https://practiceexcelonline.com/sheets/practice/countif/countif-text#webpage","@type":"WebPage","description":"In D2, use COUNTIF to count how many orders in B2:B8 came from Copenhagen.","name":"COUNTIF with a text condition in Google Sheets","url":"https://practiceexcelonline.com/sheets/practice/countif/countif-text","breadcrumb":{"@id":"https://practiceexcelonline.com/sheets/practice/countif/countif-text#breadcrumb"},"isPartOf":{"@id":"https://practiceexcelonline.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://practiceexcelonline.com/sheets/practice/countif/countif-text"]}],"primaryImageOfPage":{"@id":"https://practiceexcelonline.com/#logo"}},{"@id":"https://practiceexcelonline.com/sheets/practice/countif/countif-text#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://practiceexcelonline.com","position":1},{"@type":"ListItem","name":"Google Sheets practice exercises","item":"https://practiceexcelonline.com/sheets","position":2},{"@type":"ListItem","name":"COUNTIF","item":"https://practiceexcelonline.com/sheets/practice/countif","position":3},{"@type":"ListItem","name":"COUNTIF with a text condition in Google Sheets","position":4}]},{"@id":"https://practiceexcelonline.com/sheets/practice/countif/countif-text#/schema/learning-resource/1","@type":"LearningResource","description":"In D2, use COUNTIF to count how many orders in B2:B8 came from Copenhagen.","educationalLevel":"beginner","isAccessibleForFree":true,"learningResourceType":"exercise","name":"COUNTIF with a text condition","teaches":"COUNTIF"},{"@id":"https://practiceexcelonline.com/#logo","@type":"ImageObject","caption":"PracticeExcel","contentUrl":"https://practiceexcelonline.com/brand/practiceexcel/icon-512.png","inLanguage":"en-US","url":"https://practiceexcelonline.com/brand/practiceexcel/icon-512.png"}]}
```

## Sitemap

See the full [sitemap](https://practiceexcelonline.com/sitemap.md) for all pages.
