# Excel Count Cells With Text: COUNTIF Examples
> Use COUNTIF to count cells with text, numbers, dates, blanks and wildcard matches. Worked examples, criteria rules and the errors that break the count.

- Web page: https://logicexcel.com/functions/countif
- Language: en
- Also in: [Deutsch](https://logicexcel.com/de/functions/countif.md), [Español](https://logicexcel.com/es/functions/countif.md), [Français](https://logicexcel.com/fr/functions/countif.md)
- Updated: 2026-11-03
- Practice this in the browser: https://logicexcel.com/practice/26

To count cells with text in Excel, use `=COUNTIF(B2:B11,"*")`. The first argument is the range to look at and the second is the condition. COUNTIF counts every cell in the range that meets the condition, so the same pattern also counts exact words, numbers above a limit, dates, blanks and partial matches.

This page builds up from one ticket log: counting text, then numbers and operators, then wildcards, dates, blanks, duplicates and the traps that give a wrong total without any error message.

## TL;DR

- The pattern is `=COUNTIF(range, criteria)`. Text and operators go in quotes: `"Open"`, `">3"`, `"<>Closed"`.
- To count cells with text, use `"*"`. To count cells that are not blank, use `"<>"`. To count blank cells, use `""`.
- Wildcards work in COUNTIF: `"Acme*"` is anything starting with Acme, `"*cycl*"` is anything containing cycl, and `"?????"` is any five characters.
- To join an operator to a cell or a date, use the ampersand: `">"&H1` or `">="&DATE(2026,10,5)`.
- COUNTIF ignores upper and lower case, accepts one condition only, and counts cells, not words inside them.

## Table of Contents

- [Sample data: a helpdesk ticket log](#sample-data-a-helpdesk-ticket-log)
- [COUNTIF syntax](#countif-syntax)
- [How to count cells with a specific word](#how-to-count-cells-with-a-specific-word)
- [How to count cells with text](#how-to-count-cells-with-text)
- [How to count numbers above, below or equal to a value](#how-to-count-numbers-above-below-or-equal-to-a-value)
- [How to count cells that contain part of a word](#how-to-count-cells-that-contain-part-of-a-word)
- [How to count blank and not blank cells](#how-to-count-blank-and-not-blank-cells)
- [How to count dates](#how-to-count-dates)
- [How to count duplicates](#how-to-count-duplicates)
- [How to count with OR logic](#how-to-count-with-or-logic)
- [COUNTIF compared with other counting formulas](#countif-compared-with-other-counting-formulas)
- [Excel versions](#excel-versions)
- [Common COUNTIF errors and wrong counts](#common-countif-errors-and-wrong-counts)
- [What learners get wrong](#what-learners-get-wrong)
- [Job scenario: a Monday ticket summary](#job-scenario-a-monday-ticket-summary)
- [Practice](#practice)
- [FAQ](#faq)
- [Sources](#sources)

## Sample data: a helpdesk ticket log

All examples use this table. Row 1 holds headings, the tickets sit in rows 2 to 11, and two helper cells sit to the right: G1 holds the word Open and H1 holds the number 3.

| Row | A: Ticket | B: Customer | C: Status | D: Hours | E: Opened |
|---|---|---|---|---|---|
| 2 | T-1001 | Acme Foods | Open | 4 | 2026-10-01 |
| 3 | T-1002 | Bright Bakery | Closed | 2 | 2026-10-01 |
| 4 | T-1003 | Acme Tools | Closed | 6 | 2026-10-02 |
| 5 | T-1004 | Cape Cycles | Pending | 3 | 2026-10-03 |
| 6 | T-1005 | Acme Foods | Closed | 1 | 2026-10-05 |
| 7 | T-1006 | (empty) | Open | 8 | 2026-10-06 |
| 8 | T-1007 | Bright Bakery | Open | 5 | 2026-10-07 |
| 9 | T-1008 | Delta Dental | Pending | 7 | 2026-10-08 |
| 10 | T-1004 | Cape Cycles | Closed | 3 | 2026-10-09 |
| 11 | T-1010 | Acme Foods | Open | 2 | 2026-10-09 |

The data has two planted problems. B7 is empty because nobody recorded the customer. Ticket T-1004 appears twice, in rows 5 and 10, because it was logged again when it was reopened. The dates in column E are real dates.

## COUNTIF syntax

The pattern is `=COUNTIF(range, criteria)`.

| Argument | Required? | What it does |
|---|---|---|
| range | Required | The cells to test. It must be a range on a sheet, not a list built by a formula. |
| criteria | Required | The condition. It can be a number, text, a cell reference, or an operator with a value such as `">3"`. |

Both arguments are needed. There is no third argument, which is a common cause of errors: COUNTIF takes one range and one condition, and nothing else. When you need two conditions, switch to [COUNTIFS](https://logicexcel.com/functions/countifs).

The criteria follow a few rules:

| You want | Write the criteria as |
|---|---|
| Cells equal to a word | `"Open"` or a cell such as `G1` |
| Cells equal to a number | `3` or `"3"` |
| Greater than, less than | `">3"`, `"<3"`, `">=3"`, `"<=3"` |
| Not equal | `"<>Closed"` |
| An operator plus a value in a cell | `">"&H1` |
| Starts with, ends with, contains | `"Acme*"`, `"*Bakery"`, `"*cycl*"` |
| Any text | `"*"` |
| Not blank | `"<>"` |
| Blank | `""` or `"="` |

COUNTIF does not care about capital letters. `"open"` and `"OPEN"` find the same cells as `"Open"`.

## How to count cells with a specific word

Use `=COUNTIF(C2:C11,"Open")` to count the tickets with the status Open. It returns 4, for rows 2, 7, 8 and 11.

The same pattern with other words gives the rest of the picture. `=COUNTIF(C2:C11,"Closed")` returns 4 and `=COUNTIF(C2:C11,"Pending")` returns 2. Together that is 10, one per ticket.

Because case is ignored, `=COUNTIF(C2:C11,"open")` also returns 4.

You do not have to type the word. Point at a cell that holds it. G1 contains Open, so `=COUNTIF(C2:C11,G1)` returns 4. This is how you build a summary table: the labels sit in a column, and each formula points at its own label. Change the label and the count follows.

For "not equal", use `=COUNTIF(C2:C11,"<>Closed")`, which returns 6. That is the 4 Open plus the 2 Pending. COUNTIF also counts empty cells as "not equal", so if the Status column had gaps, they would be inside that 6. Check with `=COUNTA` if you suspect gaps.

## How to count cells with text

The formula for counting cells with text is `=COUNTIF(B2:B11,"*")`. It returns 9. The asterisk matches any run of characters, so every cell that holds text matches, and numbers and empty cells do not.

B7 is empty, which is why the answer is 9 and not 10. If you want a count that ignores cells that look empty but hold a formula returning nothing, use `=COUNTIF(B2:B11,"?*")`, which also returns 9. The question mark stands for one character, so `"?*"` means at least one character.

Two points to remember about counting text:

- Numbers are not text. `=COUNTIF(D2:D11,"*")` returns 0, because column D holds numbers only.
- Numbers stored as text do match `"*"`. If a column of codes was pasted in as text, the wildcard will count them, which may or may not be what you want.

To count the text cells in a range that mixes numbers and words, you can pair `"*"` with a count of the numbers using [COUNT](https://logicexcel.com/functions/count). The two together split a column into text cells and number cells.

## How to count numbers above, below or equal to a value

Put the operator and the number inside the quotes. `=COUNTIF(D2:D11,">3")` counts tickets that took more than 3 hours. It returns 5: the values 4, 6, 8, 5 and 7.

The rest of the operators follow the same shape:

| Formula | Returns | Why |
|---|---|---|
| `=COUNTIF(D2:D11,">=3")` | 7 | The five above 3 plus the two tickets of exactly 3 hours |
| `=COUNTIF(D2:D11,"<3")` | 3 | The values 2, 1 and 2 |
| `=COUNTIF(D2:D11,3)` | 2 | Cells equal to 3 |
| `=COUNTIF(D2:D11,"<>3")` | 8 | Everything except the two 3s |

An exact number needs no quotes or operator. `=COUNTIF(D2:D11,3)` is enough.

To take the limit from a cell, join the operator and the cell with an ampersand. H1 holds 3, so `=COUNTIF(D2:D11,">"&H1)` returns 5. Change H1 to 5 and the formula returns 2 without being edited. This is the form to use in reports, because the threshold sits in plain sight instead of inside a formula. The [logical operators guide](https://logicexcel.com/functions/logical-operators) lists every comparison symbol.

To count values between two limits, subtract one COUNTIF from another: `=COUNTIF(D2:D11,">=3")-COUNTIF(D2:D11,">5")` returns 4, the tickets of 3 to 5 hours (4, 3, 5 and 3). It also works with [COUNTIFS](https://logicexcel.com/functions/countifs), which does it in one step.

## How to count cells that contain part of a word

Wildcards let COUNTIF match part of a cell. There are three:

| Wildcard | Meaning | Example |
|---|---|---|
| `*` | Any number of characters, including none | `"Acme*"` |
| `?` | Exactly one character | `"T-100?"` |
| `~` | Treat the next `*` or `?` as a normal character | `"~*"` |

Starts with: `=COUNTIF(B2:B11,"Acme*")` returns 4, for Acme Foods three times and Acme Tools once.

Ends with: `=COUNTIF(B2:B11,"*Bakery")` returns 2.

Contains: `=COUNTIF(B2:B11,"*cycl*")` returns 2, for Cape Cycles. The match is not case-sensitive, so the capital C does not matter.

COUNTIF counts the cells that contain a letter or symbol, not how many times it appears. `"*a*"` gives the number of cells with an "a" in them, even if a cell holds three. To count every occurrence inside the cells, use LEN and SUBSTITUTE instead, as shown in the [COUNT function guide](https://logicexcel.com/functions/count).

To find a real asterisk or question mark in your data, put a tilde in front of it. The criteria `"~*"` matches a cell that is exactly an asterisk. Without the tilde, the asterisk would match everything. The [wildcard characters guide](https://logicexcel.com/functions/wildcard-characters) goes through the combinations.

Wildcards only work with text criteria. You cannot use them to match part of a number, such as all values starting with 4, unless the numbers are stored as text.

## How to count blank and not blank cells

Two forms cover the cells that have a value and the cells that do not.

- Not blank: `=COUNTIF(B2:B11,"<>")` returns 9. The criteria means "not equal to nothing".
- Blank: `=COUNTIF(B2:B11,"")` returns 1, for B7. `=COUNTIF(B2:B11,"=")` also returns 1.

The two blank forms differ on one point. `""` counts truly empty cells and cells whose formula returns an empty string, while `"="` counts only truly empty cells. The "not blank" form `"<>"` counts anything that is not truly empty, so it includes a cell whose formula returns an empty string. A cell with a single space in it counts as not blank, because the space is a character. If a count looks too high, click a supposedly empty cell and check the formula bar.

To count not blank across numbers and text together, `"<>"` works for both. If you want a function without criteria, `=COUNTA(B2:B11)` also returns 9. The [COUNT function guide](https://logicexcel.com/functions/count) compares COUNT, COUNTA and COUNTBLANK.

One trap: `"<>Acme Foods"` counts the blank cells too. `=COUNTIF(B2:B11,"<>Acme Foods")` returns 7, which is the 6 other names plus the empty B7. If you only want filled cells that are not Acme Foods, use COUNTIFS with a second condition of `"<>"`.

## How to count dates

Dates are numbers, so the number rules apply. Build the comparison with an ampersand and the DATE function so the formula does not depend on how a date is typed.

To count tickets opened on or after 5 October 2026, use `=COUNTIF(E2:E11,">="&DATE(2026,10,5))`. It returns 6, for the dates 5, 6, 7, 8 and two on 9 October.

To count tickets opened on one exact day, use `=COUNTIF(E2:E11,DATE(2026,10,9))`. It returns 2.

Do not use a date as plain text unless you are sure how Excel will read it. A text such as `"10/9/2026"` can mean 9 October or 10 September depending on the regional settings of the computer. The DATE function removes the doubt. The [date functions guide](https://logicexcel.com/functions/date-functions) covers building dates safely.

For a date range, such as all of October's first week, switch to COUNTIFS with two date conditions.

## How to count duplicates

Use COUNTIF with a cell as the criteria, and lock the range with dollar signs. In a helper column next to the tickets, put `=COUNTIF($A$2:$A$11,A2)` in row 2. It returns 1 for T-1001. Copied down to row 5 it becomes `=COUNTIF($A$2:$A$11,A5)` and returns 2, because T-1004 appears twice.

To turn that into a flag, wrap it in IF: `=IF(COUNTIF($A$2:$A$11,A5)>1,"Duplicate","")` returns the word Duplicate for row 5 and an empty string for row 2. The dollar signs matter. Without them the range slides down as you copy and the counts become wrong. The [absolute reference guide](https://logicexcel.com/functions/absolute-reference) explains the dollar signs.

To count how many rows are involved in duplicates, use `=SUMPRODUCT(--(COUNTIF(A2:A11,A2:A11)>1))`. It returns 2, one for each T-1004 row. To count the distinct tickets instead, see the [count unique values guide](https://logicexcel.com/functions/count-unique-values). To highlight duplicates in color, the same COUNTIF test works as a rule in [conditional formatting formulas](https://logicexcel.com/functions/conditional-formatting-formulas).

## How to count with OR logic

COUNTIF has one condition, so OR logic needs a small workaround. To count tickets that are Open or Pending, add two COUNTIFs: `=COUNTIF(C2:C11,"Open")+COUNTIF(C2:C11,"Pending")` returns 6.

A shorter version puts both words in an array constant and sums the results: `=SUM(COUNTIF(C2:C11,{"Open","Pending"}))` also returns 6. It is easy to extend to a third word. Use it when the words are fixed and few. If the list is long or changes, put the words in cells and use SUMPRODUCT with COUNTIF.

Do not try to get OR logic from COUNTIFS. Several conditions in COUNTIFS are joined by AND, and they rule out each other when they test the same column.

## COUNTIF compared with other counting formulas

| Formula | Use it when | Limit |
|---|---|---|
| COUNTIF | One condition on one range | Cannot test two columns at once |
| [COUNTIFS](https://logicexcel.com/functions/countifs) | Two or more conditions joined by AND | Every range must be the same size |
| [COUNT](https://logicexcel.com/functions/count) | You want all numbers in a range | No condition at all |
| COUNTA | You want all non-empty cells | No condition at all |
| [SUMIF](https://logicexcel.com/functions/sumif) | You want to add values, not count them | Adds the matching cells in a sum range |
| SUMPRODUCT | The condition needs a calculation, such as the length of the text | Slower on large ranges |
| Pivot table | You want counts for every category at once | Needs a refresh when data changes |

Pick COUNTIF first. Move to COUNTIFS the moment a second column enters the question, and to SUMPRODUCT when the test is a calculation that criteria cannot express.

## Excel versions

COUNTIF exists in every version of Excel, including 2010, 2013, 2016, 2019, 2021, Microsoft 365, Excel for the web and Excel for Mac. The criteria rules and wildcards are the same on all of them.

The range argument must be a real range on a sheet. COUNTIF cannot take an array that another formula creates, such as `D2:D11*2`. Use SUMPRODUCT when you need to count on a calculated list. The array constant `{"Open","Pending"}` is allowed in the criteria, as shown above.

COUNTIF can refer to another workbook, but the formula returns #VALUE! when the other workbook is closed. Open the source file first.

## Common COUNTIF errors and wrong counts

| What you see | Cause | Fix |
|---|---|---|
| 0 from `=COUNTIF(C2:C11,Open)`, with no error | The word Open has no quotes, so Excel looks for a name that does not exist and counts nothing | Write `"Open"` in quotes, or point at a cell |
| `#NAME?` for `=COUNTSIF(C2:C11,"Open")` | The function name is misspelled | The name is COUNTIF, and no letters are added |
| Excel will not accept the formula | The operator is outside the quotes, as in `>3`, or the comma is missing | Write `">3"` and keep the comma between the range and the criteria |
| A warning that you entered too many arguments | A second range and criteria pair was added, which COUNTIF does not allow | Use COUNTIFS for more conditions |
| The count is 0 but you can see matches | The cells have trailing spaces, or numbers stored as text are tested with an operator such as `">3"` | Clean with TRIM, or use a wildcard such as `"Open*"` |
| The count is far too big | The range is a whole column and the criteria is `"<>x"` | Use the exact data range, since blank cells match "not equal" |
| `#VALUE!` | The range sits in a closed workbook | Open the workbook |
| Wrong count for long text | Strings of more than 255 characters are not matched properly | Shorten the text or use another formula |
| Long numbers such as card numbers match each other | COUNTIF compares only the first 15 digits of a number | Store them as text and add a wildcard, or test with SUMPRODUCT |

## What learners get wrong

Between 26 September and 3 November 2026, learners made 3,338 first attempts across our [COUNTIF Function lesson](https://logicexcel.com/practice/26), and 63.2% were right. Across the [COUNT Practice lesson](https://logicexcel.com/practice/56) there were 1,444 first attempts, with 75.4% right. A first attempt is the first check of a screen in a page view, not a person. Four patterns show up.

**Whole column with "not equal".** Asked for the number of branches where sales was not equal to 500, only 28.8% of 299 first attempts were right. The accepted answer is `=COUNTIF(C2:C8,"<>500")`. The most common wrong answer, with 66 first attempts, was `=COUNTIF(C:C,"<>500")`. The whole-column version counts every empty cell down to row 1,048,576, because empty cells are not equal to 500. The same screen drew `=COUNTIF(C2:C8,"!=500")` 17 times. The `!=` form is not Excel syntax: Excel writes "not equal" as `<>`.

**Missing quotes around the operator.** The screen asking for sales below 400 had 501 first attempts, 55.5% right. The accepted answer is `=COUNTIF(C2:C8,"<400")`. The wrong forms include `=COUNTIF(C2:C8,<400)`, 8 first attempts, with no quotes, and `=COUNTIF(C2:C8<200)`, 7 first attempts, with no comma. Another 18 used `=COUNTIF(C2:C8,<200)`, which has the wrong number as well as missing quotes. An operator is text to COUNTIF, so it goes between quotes together with the number.

**Typing the formula when the screen wants the result.** The question "what would `=COUNTIF(A2:A8,"M*")` return" had 329 first attempts, 41.9% right. The answer is 2. The top wrong answer, 84 first attempts, was the formula itself. Another 4 typed the two city names instead of the number. Read the question: a formula in, a number out.

**Using COUNT with a condition.** In the COUNT Practice lesson, the screen for countries producing more than 800 tonnes of bananas had 148 first attempts, 79.1% right. The wrong `=COUNT(B:B,">800")` appeared 8 times, and `=COUNT(D:D,">100")` appeared 5 times on the avocado screen, which had 71.0% of 145 first attempts right. COUNT has no condition argument. It counts the numbers in the column and ignores the text `">800"`, so it returns the total of numbers in the column. Switch to COUNTIF the moment a condition appears.

## Job scenario: a Monday ticket summary

Your manager asks for a status summary and a list of duplicates before the Monday meeting.

1. **Total tickets.** `=COUNTA(A2:A11)` returns 10. This is the denominator for everything else.
2. **Counts by status.** Use `=COUNTIF(C2:C11,"Open")`, `=COUNTIF(C2:C11,"Closed")` and `=COUNTIF(C2:C11,"Pending")`, which return 4, 4 and 2. They add up to 10, so no ticket is missing a status. If they did not add up, you would look for typos such as "Closd".
3. **Share still open.** `=COUNTIF(C2:C11,"Open")/COUNTA(C2:C11)` returns 0.4, which you format as 40%.
4. **Long tickets.** `=COUNTIF(D2:D11,">"&H1)` returns 5 tickets over the 3 hour limit in H1. Change H1 and the report updates.
5. **Duplicates.** Put `=IF(COUNTIF($A$2:$A$11,A2)>1,"Duplicate","")` in a helper column and copy it down. Row 5 and row 10 get the flag. Merge them or ask whoever reopened the ticket to reuse the old row.
6. **Missing customers.** `=COUNTIF(B2:B11,"")` returns 1, which tells you one ticket needs a customer name before the report goes out.

That is six numbers from one function, and each answers a question someone will ask in the meeting.

## Practice

Open [Practice Lesson 26](https://logicexcel.com/practice/26) and type the formulas instead of reading them. Then do [Practice Lesson 56](https://logicexcel.com/practice/56), which asks counting questions over a larger table and is where the COUNT-with-a-condition mistake shows up. When you finish, the [Excel functions cheat sheet](https://logicexcel.com/functions/excel-functions-cheat-sheet) is a good place to keep the whole family within reach.

A drill: copy the ticket log into a blank sheet and write the formula for each question without looking. How many tickets are not Pending? How many customers start with B? How many tickets took exactly 2 hours? Check your answers against this page.

## FAQ

### How do I count cells with text in Excel using COUNTIF?

Use `=COUNTIF(B2:B11,"*")`. The asterisk is a wildcard for any text, so the formula counts every cell in B2:B11 that holds text and skips numbers and empty cells. For a cell that contains a particular word, put the word between asterisks, such as `"*cycl*"`. Matching ignores case.

### What is the formula for counting cells that are not blank?

Use `=COUNTIF(B2:B11,"<>")`. It counts every cell that has content, whether text or numbers. You can also use `=COUNTA(B2:B11)`, which needs no criteria. A cell that contains only a space counts as not blank, so clean stray spaces first if the number looks too high.

### How do I use COUNTIF with a greater than or less than condition?

Put the operator and the number in quotes: `=COUNTIF(D2:D11,">3")`. To take the limit from a cell, join them with an ampersand: `=COUNTIF(D2:D11,">"&H1)`. Never leave the operator outside the quotes. If H1 holds 3, both formulas return 5 on the ticket log.

### Can COUNTIF count more than one condition?

Not by itself. COUNTIF accepts one range and one condition. For two conditions that must both be true, use COUNTIFS, which takes as many range and criteria pairs as you need. For an either-or test, add two COUNTIFs together, such as `=COUNTIF(C2:C11,"Open")+COUNTIF(C2:C11,"Pending")`, which returns 6.

### Is COUNTIF case sensitive?

No. `"Open"`, `"open"` and `"OPEN"` all count the same cells, and wildcard patterns ignore case in the same way. If you need a case-sensitive count, use SUMPRODUCT with the EXACT function, which compares text exactly and respects capital letters. COUNTIF cannot do that.

### How do I count cells that contain a certain character?

Wrap the character in asterisks: `=COUNTIF(B2:B11,"*a*")` counts the cells that have an "a" anywhere in them. This counts cells, not occurrences. A cell with three letter a's still counts as one. To count every occurrence, use LEN and SUBSTITUTE together.

### Why does COUNTIF return 0 when I can see matching cells?

The cells probably do not match exactly. Look for trailing spaces, a number stored as text, or a different spelling. Try a wildcard such as `"Open*"` to catch trailing spaces, or clean the column with TRIM. Also check that the range really covers the cells you are looking at.

## Sources

- [COUNTIF function, Microsoft Support](https://support.microsoft.com/en-us/office/countif-function-e0de10c6-f885-4e71-abb4-1f464816df34)
- [COUNTIFS function, Microsoft Support](https://support.microsoft.com/en-us/office/countifs-function-dda3dc6e-f74e-4aee-88bc-aa8c2a866842)
