# How to count cells that do not contain specific text in Excel

Put "not equal" in front of the wildcard pattern: `=COUNTIF(A2:A11,"<>*"&E1&"*")`.

**Excel:** `=COUNTIF(A2:A11,"<>*"&E1&"*")` (Every current version)

**Google Sheets:** the same formula works.

## Example

Sample data (row 1 is the header):

| A | B | C | D | E |
| --- | --- | --- | --- | --- |
| Product |  |  | Text | cable |
| Wireless mouse |  |  | Products |  |
| USB-C cable 1m |  |  |  |  |
| Wireless keyboard |  |  |  |  |
| HDMI cable 2m |  |  |  |  |
| Laptop stand |  |  |  |  |
| Wireless charger |  |  |  |  |
| Monitor arm |  |  |  |  |
| USB hub |  |  |  |  |
| Webcam HD |  |  |  |  |
| Cable organizer |  |  |  |  |

Formula in E2: `=COUNTIF(A2:A11,"<>*"&E1&"*")`

Result: 7

## How it works

`"*cable*"` matches any name containing "cable", and putting `<>` in front turns it around: count everything that doesn't match. Three names contain "cable" (in any case), so seven don't.

## Other ways

- `=SUMPRODUCT(--ISERROR(SEARCH(E1,A2:A11)))`: SEARCH fails where the text is missing, so counting the errors counts the cells without it.
- `=ROWS(A2:A11)-COUNTIF(A2:A11,"*"&E1&"*")`: All rows minus the ones that contain the text.

## Common mistakes

- Blank cells don't contain the text, so they are counted. Add `,A2:A11,"<>"` in COUNTIFS to skip them.
- The match ignores case. For a case-sensitive version use `=SUMPRODUCT(--ISERROR(FIND(E1,A2:A11)))`.

## Questions

**How do I exclude two words?**

Use COUNTIFS with two "<>" patterns: `=COUNTIFS(A2:A11,"<>*cable*",A2:A11,"<>*wireless*")`.

**How do I list the cells that don't contain the text?**

In Excel 365 or Google Sheets: `=FILTER(A2:A11,ISERROR(SEARCH(E1,A2:A11)))`.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/count-cells-that-do-not-contain-text
