# How to sum if a cell does not contain specific text in Excel

Put "<>" in front of the wildcard pattern: `=SUMIF(A2:A9,"<>*"&E1&"*",B2:B9)`.

**Excel:** `=SUMIF(A2:A9,"<>*"&E1&"*",B2:B9)` (Every current version)

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

## Example

Sample data (row 1 is the header):

| A | B | C | D | E |
| --- | --- | --- | --- | --- |
| Description | Amount |  | Leave out | transfer |
| Card payment - Fuel Stop | 58.4 |  | Spending |  |
| Transfer to savings | 500 |  |  |  |
| Card payment - Market | 126.85 |  |  |  |
| Online transfer to J. Kim | 75 |  |  |  |
| Direct debit - Gym | 39 |  |  |  |
| Card payment - Pharmacy | 22.6 |  |  |  |
| Transfer to credit card | 350 |  |  |  |
| Direct debit - Phone | 45 |  |  |  |

Formula in E2: `=SUMIF(A2:A9,"<>*"&E1&"*",B2:B9)`

Result: $291.85

## How it works

`"*transfer*"` matches any text containing "transfer", in any case. Putting `<>` in front turns it around: SUMIF adds the rows that do **not** match. That leaves the real spending and drops the money moved between accounts.

## Other ways

- `=SUMPRODUCT(ISERROR(SEARCH(E1,A2:A9))*B2:B9)`: SEARCH errors when the word is missing, so ISERROR is TRUE for the rows to keep. Swap SEARCH for FIND to make it case-sensitive.

## Common mistakes

- The wildcard also matches inside longer words: "art" excludes "Smart TV". Add spaces around the word or use a category column if that matters.
- Blank descriptions don't contain the word, so their amounts are included.

## Questions

**How do I exclude two different words?**

Use SUMIFS with one condition per word: `=SUMIFS(B2:B9,A2:A9,"<>*transfer*",A2:A9,"<>*refund*")`.

**How do I sum only the rows that do contain the word?**

Drop the `<>`: `=SUMIF(A2:A9,"*"&E1&"*",B2:B9)`.

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/sum-if-cell-does-not-contain-text
