---
title: "COUNTIF function in Excel: syntax and examples | ExcelSavvy"
description: "How to use COUNTIF in Excel and Google Sheets: count cells with text, numbers or wildcards. Examples and a live drill."
canonical_url: "https://excelsavvy.com/functions/countif"
meta:
  "og:description": "How to use COUNTIF in Excel and Google Sheets: count cells with text, numbers or wildcards. Examples and a live drill."
  "og:image": "https://excelsavvy.com/_og/d/c_Page%2Ctitle_~Q09VTlRJRiBmdW5jdGlvbiBpbiBFeGNlbDogc3ludGF4IGFuZCBleGFtcGxlcw%2Cdescription_~SG93IHRvIHVzZSBDT1VOVElGIGluIEV4Y2VsIGFuZCBHb29nbGUgU2hlZXRzOiBjb3VudCBjZWxscyB3aXRoIHRleHQsIG51bWJlcnMgb3Igd2lsZGNhcmRzLiBFeGFtcGxlcyBhbmQgYSBsaXZlIGRyaWxsLg%2Ceyebrow_Excel%2Bfunctions%2Csite_practiceexcel%2Ccode_~Q09VTlRJRihyYW5nZSwgY3JpdGVyaWEp%2Cp_Ii9mdW5jdGlvbnMvY291bnRpZiI%2Cs_feXOBSbBrDz85ftW.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "COUNTIF function in Excel: syntax and examples | ExcelSavvy"
  "twitter:image": "https://excelsavvy.com/_og/d/c_Page%2Ctitle_~Q09VTlRJRiBmdW5jdGlvbiBpbiBFeGNlbDogc3ludGF4IGFuZCBleGFtcGxlcw%2Cdescription_~SG93IHRvIHVzZSBDT1VOVElGIGluIEV4Y2VsIGFuZCBHb29nbGUgU2hlZXRzOiBjb3VudCBjZWxscyB3aXRoIHRleHQsIG51bWJlcnMgb3Igd2lsZGNhcmRzLiBFeGFtcGxlcyBhbmQgYSBsaXZlIGRyaWxsLg%2Ceyebrow_Excel%2Bfunctions%2Csite_practiceexcel%2Ccode_~Q09VTlRJRihyYW5nZSwgY3JpdGVyaWEp%2Cp_Ii9mdW5jdGlvbnMvY291bnRpZiI%2Cs_feXOBSbBrDz85ftW.png"
---

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

# **The COUNTIF function**

Counts the cells in a range that meet one condition. Text conditions ignore upper and lower case.

=

COUNTIF(

## **How to use COUNTIF**

COUNTIF answers the question "how many?" for one condition. Think of ticking names off a list: how many say North, how many sales are over 300, how many cells are still empty.

You give it the range to look through and the condition: `**=COUNTIF(A2:A10,"North")**`. Text matching ignores upper and lower case, and the condition has to match the whole cell unless you use wildcards. `**"*north*"**` finds north anywhere in the cell and `**"N*"**` finds everything that starts with N. Numbers and dates use a comparison in quotes, such as `**">=300"**`. To compare with a cell, join the two with `**&**`, like `**"<>"&D1**`.

Two shortcuts are worth knowing: `**"<>"**` counts the cells that are not empty, and `**""**` counts the empty ones.

There is no sum range here, because the range you check is also the range you count. COUNTIF holds one condition. For several conditions, or for values between two limits, use COUNTIFS. To add up amounts instead of counting rows, use SUMIF.

## **Syntax**

```
COUNTIF(range, criteria)
```

<dl><dt>**range **</dt>
<dd>The cells to count.</dd>
<dt>**criteria **</dt>
<dd>The condition, such as "North", "&gt;=300", "*shoe*" or a cell.</dd></dl>

## **Examples**

E1`=COUNTIF(<sup>1</sup>A2:A6,<sup>2</sup>"North")`

|  | A | B | C | D | E |
| --- | --- | --- | --- | --- | --- |
| 1 | Region | Product | Sales |  | **3** |
| 2 | North | Shoes | 500 |  | |
| 3 | South | Shoes | 300 |  | |
| 4 | North | Bags | 250 |  | |
| 5 | North | Shoes | 420 |  | |
| 6 | South | Bags | 180 |  | |

**In plain words:** Count the cells <sup>1</sup>in A2:A6 that say <sup>2</sup>North.

E1=COUNTIF(C2:C6,">=300")

|  | A | B | C | D | E |
| --- | --- | --- | --- | --- | --- |
| 1 | Region | Product | Sales |  | **3** |
| 2 | North | Shoes | 500 |  | |
| 3 | South | Shoes | 300 |  | |
| 4 | North | Bags | 250 |  | |
| 5 | North | Shoes | 420 |  | |
| 6 | South | Bags | 180 |  | |

## **Common COUNTIF mistakes**

- COUNTIF returns 0 for text that is clearly in the cells

  A text condition has to match the whole cell. To find a word anywhere inside the text, put asterisks around it: `**=COUNTIF(A2:A6,"*north*")**`. Extra spaces at the start or end of a cell also break an exact match.
- A condition like ">E1" counts nothing

  Inside quotes, E1 is just the two letters E1. Join the operator and the cell with &: `**=COUNTIF(C2:C6,">"&E1)**`.
- COUNTIF shows an error when I give it two conditions

  COUNTIF takes one condition, so a second pair of range and condition is too many arguments. Use COUNTIFS and repeat the range: `**=COUNTIFS(C2:C6,">=200",C2:C6,"<=400")**`.
- Counting by date gives the wrong number

  A date typed inside quotes depends on the date settings of the file, and dates stored as text are not counted as dates. Build the date with DATE: `**=COUNTIF(A2:A100,">"&DATE(2024,1,1))**`.

## **Practice COUNTIF**

- [**1****COUNTIF with a text condition**→](https://excelsavvy.com/practice/countif/countif-text)
- [**2****COUNTIF with a number condition**→](https://excelsavvy.com/practice/countif/countif-greater-than)
- [**3****COUNTIF with the limit in a cell**→](https://excelsavvy.com/practice/countif/countif-criteria-from-a-cell)
- [**4****Count everything except one value**→](https://excelsavvy.com/practice/countif/countif-not-equal)
- [**5****Count with a wildcard**→](https://excelsavvy.com/practice/countif/countif-wildcard-contains)
- [**6****Find duplicates**→](https://excelsavvy.com/practice/conditional-formatting/find-duplicates)

## **Read the guide**

- [**Free Excel course online: learn Excel from your first formula to job-ready**](https://excelsavvy.com/learn/how-to-learn-excel)
- [**Pivot tables explained, and the formulas that do the same job**](https://excelsavvy.com/learn/pivot-tables)
- [**Conditional formatting in Excel: highlight cells and rows with rules and formulas**](https://excelsavvy.com/learn/conditional-formatting-excel)
- [**How to create a drop-down list in Excel, and make it update itself**](https://excelsavvy.com/learn/drop-down-list-excel)
- [**Excel practice data: free datasets with tasks and answers**](https://excelsavvy.com/learn/excel-practice-data)
- [**Excel calendar 2026: build your own with week numbers and holidays**](https://excelsavvy.com/learn/excel-calendar-2026)
- [**Excel inventory data: free practice file with tasks and answers**](https://excelsavvy.com/learn/excel-inventory-data)
- [**Excel customer data: free practice file with tasks and answers**](https://excelsavvy.com/learn/excel-customer-data)
- [**Excel data cleaning practice: a messy file with tasks and answers**](https://excelsavvy.com/learn/excel-data-cleaning-practice)
- [**Excel finance data: free practice file with tasks and answers**](https://excelsavvy.com/learn/excel-finance-practice-data)

## **Questions**

<details>

<summary>

### How do I count cells that contain a word?

</summary>

Use wildcards: =COUNTIF(A2:A6,"\*north\*") counts cells with "north" anywhere in them.

</details>

<details>

<summary>

### How do I use COUNTIF with multiple criteria?

</summary>

COUNTIF takes one condition. Use COUNTIFS when every condition must be true: =COUNTIFS(A2:A6,"North",B2:B6,"Shoes"). When either condition may be true, add two COUNTIF formulas: =COUNTIF(A2:A6,"North")+COUNTIF(A2:A6,"South").

</details>

<details>

<summary>

### How do I count cells that are not empty?

</summary>

Use &lt;&gt; as the condition: =COUNTIF(A2:A6,"&lt;&gt;") counts the cells that have something in them, and =COUNTIF(A2:A6,"") counts the empty ones.

</details>

<details>

<summary>

### How do I count cells that do not equal a value?

</summary>

Put &lt;&gt; in front of the value: =COUNTIF(A2:A6,"&lt;&gt;North"). If the value is in a cell, write "&lt;&gt;"&amp;D1.

</details>

## **Related functions**

- [**COUNTIFS**](https://excelsavvy.com/functions/countifs)
- [**SUMIF**](https://excelsavvy.com/functions/sumif)
- [**COUNTA**](https://excelsavvy.com/functions/counta)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://excelsavvy.com/#identity","@type":"Organization","name":"ExcelSavvy","url":"https://excelsavvy.com/","logo":{"@id":"https://excelsavvy.com/#logo"}},{"@id":"https://excelsavvy.com/#website","@type":"WebSite","inLanguage":"en-US","name":"ExcelSavvy","url":"https://excelsavvy.com/","alternateName":["Excel Savvy","ExcelSavvy.com","PracticeExcel","Practice Excel Online"],"publisher":{"@id":"https://excelsavvy.com/#identity"},"workTranslation":[{"@id":"https://excelopgaver.dk/#website"},{"@id":"https://excelpraxis.de/#website"}]},{"@id":"https://excelsavvy.com/functions/countif#webpage","dateModified":"2026-11-16","description":"How to use COUNTIF in Excel and Google Sheets: count cells with text, numbers or wildcards. Examples and a live drill.","name":"COUNTIF function in Excel: syntax and examples","url":"https://excelsavvy.com/functions/countif","@type":["WebPage","FAQPage"],"breadcrumb":{"@id":"https://excelsavvy.com/functions/countif#breadcrumb"},"isPartOf":{"@id":"https://excelsavvy.com/#website"},"mainEntity":[{"@id":"https://excelsavvy.com/functions/countif#/schema/question/1"},{"@id":"https://excelsavvy.com/functions/countif#/schema/question/2"},{"@id":"https://excelsavvy.com/functions/countif#/schema/question/3"},{"@id":"https://excelsavvy.com/functions/countif#/schema/question/4"}],"potentialAction":[{"@type":"ReadAction","target":["https://excelsavvy.com/functions/countif"]}],"primaryImageOfPage":{"@id":"https://excelsavvy.com/#logo"}},{"@id":"https://excelsavvy.com/functions/countif#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://excelsavvy.com","position":1},{"@type":"ListItem","name":"Excel functions","item":"https://excelsavvy.com/functions","position":2},{"@type":"ListItem","name":"COUNTIF function in Excel: syntax and examples","position":3}]},{"@id":"https://excelsavvy.com/functions/countif#article","dateModified":"2026-11-16","description":"How to use COUNTIF in Excel and Google Sheets: count cells with text, numbers or wildcards. Examples and a live drill.","headline":"COUNTIF function in Excel: syntax and examples","inLanguage":"en-US","thumbnailUrl":"https://excelsavvy.com/_og/d/c_Page%2Ctitle_~Q09VTlRJRiBmdW5jdGlvbiBpbiBFeGNlbDogc3ludGF4IGFuZCBleGFtcGxlcw%2Cdescription_~SG93IHRvIHVzZSBDT1VOVElGIGluIEV4Y2VsIGFuZCBHb29nbGUgU2hlZXRzOiBjb3VudCBjZWxscyB3aXRoIHRleHQsIG51bWJlcnMgb3Igd2lsZGNhcmRzLiBFeGFtcGxlcyBhbmQgYSBsaXZlIGRyaWxsLg%2Ceyebrow_Excel%2Bfunctions%2Csite_practiceexcel%2Ccode_~Q09VTlRJRihyYW5nZSwgY3JpdGVyaWEp%2Cp_Ii9mdW5jdGlvbnMvY291bnRpZiI%2Cs_feXOBSbBrDz85ftW.png","@type":["Article","TechArticle"],"author":{"@id":"https://excelsavvy.com/#identity"},"image":{"@id":"https://excelsavvy.com/#/schema/image/1"},"isPartOf":{"@id":"https://excelsavvy.com/functions/countif#webpage"},"mainEntityOfPage":{"@id":"https://excelsavvy.com/functions/countif#webpage"},"publisher":{"@id":"https://excelsavvy.com/#identity"}},{"@id":"https://excelsavvy.com/functions/countif#/schema/question/1","@type":"Question","inLanguage":"en-US","name":"How do I count cells that contain a word?","acceptedAnswer":{"@type":"Answer","text":"Use wildcards: =COUNTIF(A2:A6,\"*north*\") counts cells with \"north\" anywhere in them."}},{"@id":"https://excelsavvy.com/functions/countif#/schema/question/2","@type":"Question","inLanguage":"en-US","name":"How do I use COUNTIF with multiple criteria?","acceptedAnswer":{"@type":"Answer","text":"COUNTIF takes one condition. Use COUNTIFS when every condition must be true: =COUNTIFS(A2:A6,\"North\",B2:B6,\"Shoes\"). When either condition may be true, add two COUNTIF formulas: =COUNTIF(A2:A6,\"North\")+COUNTIF(A2:A6,\"South\")."}},{"@id":"https://excelsavvy.com/functions/countif#/schema/question/3","@type":"Question","inLanguage":"en-US","name":"How do I count cells that are not empty?","acceptedAnswer":{"@type":"Answer","text":"Use \u003C> as the condition: =COUNTIF(A2:A6,\"\u003C>\") counts the cells that have something in them, and =COUNTIF(A2:A6,\"\") counts the empty ones."}},{"@id":"https://excelsavvy.com/functions/countif#/schema/question/4","@type":"Question","inLanguage":"en-US","name":"How do I count cells that do not equal a value?","acceptedAnswer":{"@type":"Answer","text":"Put \u003C> in front of the value: =COUNTIF(A2:A6,\"\u003C>North\"). If the value is in a cell, write \"\u003C>\"&D1."}},{"@id":"https://excelsavvy.com/#logo","@type":"ImageObject","caption":"ExcelSavvy","contentUrl":"https://excelsavvy.com/brand/practiceexcel/icon-512.png?v=3","inLanguage":"en-US","url":"https://excelsavvy.com/brand/practiceexcel/icon-512.png?v=3"},{"@id":"https://excelsavvy.com/#/schema/image/1","@type":"ImageObject","contentUrl":"https://excelsavvy.com/_og/d/c_Page%2Ctitle_~Q09VTlRJRiBmdW5jdGlvbiBpbiBFeGNlbDogc3ludGF4IGFuZCBleGFtcGxlcw%2Cdescription_~SG93IHRvIHVzZSBDT1VOVElGIGluIEV4Y2VsIGFuZCBHb29nbGUgU2hlZXRzOiBjb3VudCBjZWxscyB3aXRoIHRleHQsIG51bWJlcnMgb3Igd2lsZGNhcmRzLiBFeGFtcGxlcyBhbmQgYSBsaXZlIGRyaWxsLg%2Ceyebrow_Excel%2Bfunctions%2Csite_practiceexcel%2Ccode_~Q09VTlRJRihyYW5nZSwgY3JpdGVyaWEp%2Cp_Ii9mdW5jdGlvbnMvY291bnRpZiI%2Cs_feXOBSbBrDz85ftW.png","inLanguage":"en-US","url":"https://excelsavvy.com/_og/d/c_Page%2Ctitle_~Q09VTlRJRiBmdW5jdGlvbiBpbiBFeGNlbDogc3ludGF4IGFuZCBleGFtcGxlcw%2Cdescription_~SG93IHRvIHVzZSBDT1VOVElGIGluIEV4Y2VsIGFuZCBHb29nbGUgU2hlZXRzOiBjb3VudCBjZWxscyB3aXRoIHRleHQsIG51bWJlcnMgb3Igd2lsZGNhcmRzLiBFeGFtcGxlcyBhbmQgYSBsaXZlIGRyaWxsLg%2Ceyebrow_Excel%2Bfunctions%2Csite_practiceexcel%2Ccode_~Q09VTlRJRihyYW5nZSwgY3JpdGVyaWEp%2Cp_Ii9mdW5jdGlvbnMvY291bnRpZiI%2Cs_feXOBSbBrDz85ftW.png"}]}
```

## Sitemap

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