# How to check if a cell contains one of several words in Excel

Search for every word in a list at once and count the hits: =IF(SUMPRODUCT(--ISNUMBER(SEARCH($D$2:$D$4,A2)))>0,"Escalate","").

**Excel:** `=IF(SUMPRODUCT(--ISNUMBER(SEARCH($D$2:$D$4,A2)))>0,"Escalate","")` (Every current version)

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

## Example

Sample data (row 1 is the header):

| A | B | C | D |
| --- | --- | --- | --- |
| Ticket subject | Priority |  | Keywords |
| Please refund my order |  |  | refund |
| Where is my package? |  |  | cancel |
| Cancel my subscription |  |  | chargeback |
| Chargeback notice received |  |  |  |
| Update billing address |  |  |  |
| Refunded twice? |  |  |  |
| Love the new app |  |  |  |

Formula in B2, filled to B8: `=IF(SUMPRODUCT(--ISNUMBER(SEARCH($D$2:$D$4,A2)))>0,"Escalate","")`

Result: Escalate; ; Escalate; Escalate; ; Escalate; 

## How it works

SEARCH looks for each keyword in the subject and returns a position for each one it finds and #VALUE! for the rest. ISNUMBER turns those into TRUE or FALSE, `--` into 1 or 0, and SUMPRODUCT adds them up. Any total above zero means at least one keyword is there; "Refunded" contains "refund", so it is escalated.

## Other ways

- `=IF(OR(ISNUMBER(SEARCH("refund",A2)),ISNUMBER(SEARCH("cancel",A2)),ISNUMBER(SEARCH("chargeback",A2))),"Escalate","")`: The words typed into the formula. Fine for two or three words that never change.
- `=IF(COUNT(SEARCH($D$2:$D$4,A2)),"Escalate","")`: COUNT counts the positions SEARCH found. Excel 365 and 2021; Google Sheets needs ARRAYFORMULA around it.

## Common mistakes

- An empty cell in the keyword range matches every subject, because SEARCH finds "" at position 1. Keep the range to filled cells.
- Short keywords match inside longer words: "app" is found in "happy".
- SEARCH ignores case. Use FIND when case matters.

## Questions

**How do I return the keyword that was found?**

`=XLOOKUP(TRUE,ISNUMBER(SEARCH($D$2:$D$4,A2)),$D$2:$D$4,"")` returns the first matching keyword.

**How do I count how many keywords appear?**

Drop the comparison: `=SUMPRODUCT(--ISNUMBER(SEARCH($D$2:$D$4,A2)))`.

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/if-cell-contains-one-of-several-words
