How to check if a cell contains one of several words in Excel
Formula (Excel and Google Sheets)
=IF(SUMPRODUCT(--ISNUMBER(SEARCH($D$2:$D$4,A2)))>0,"Escalate","")Search for every word in a list at once and count the hits: =IF(SUMPRODUCT(--ISNUMBER(SEARCH($D$2:$D$4,A2)))>0,"Escalate","").
- Result on the example
- one result per row in
B2, filled down toB8 - Works in
- Every current version
- Google Sheets
- Same formula
See it work
The formula is already in B2, filled down to B8. Change any input and the result updates, or edit the formula to experiment.
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.
=IF(SUMPRODUCT(--ISNUMBER(SEARCH($D$2:$D$4,A2)))>0,"Escalate","")Result"Escalate"
$D$2:$D$43 rows × 1 col: "refund", "cancel", "chargeback"A range: 3 cells in one column.
A2"Please refund my order"The value in A2.
SEARCH($D$2:$D$4,A2){3 rows × 1 col} 8, #VALUE!, #VALUE!SEARCH: Position of text, not case-sensitive, allows wildcards.- find_text
$D$2:$D$43 rows × 1 col: "refund", "cancel", "chargeback" - within_text
A2"Please refund my order"
- find_text
ISNUMBER(SEARCH($D$2:$D$4,A2)){3 rows × 1 col} TRUE, FALSE, FALSEISNUMBER: TRUE if the value is a number.- value
SEARCH($D$2:$D$4,A2){3 rows × 1 col} 8, #VALUE!, #VALUE!
- value
-ISNUMBER(SEARCH($D$2:$D$4,A2)){3 rows × 1 col} -1, 0, 0Makes the value negative.
--ISNUMBER(SEARCH($D$2:$D$4,A2)){3 rows × 1 col} 1, 0, 0Makes the value negative.
SUMPRODUCT(--ISNUMBER(SEARCH($D$2:$D$4,A2)))1SUMPRODUCT: Multiplies arrays row by row and adds the results.- array1
--ISNUMBER(SEARCH($D$2:$D$4,A2)){3 rows × 1 col} 1, 0, 0
- array1
SUMPRODUCT(--ISNUMBER(SEARCH($D$2:$D$4,A2)))>0TRUEThe > operator tests greater than.
IF(SUMPRODUCT(--ISNUMBER(SEARCH($D$2:$D$4,A2)))>0,"Escalate","")"Escalate"IF: Returns one value if a test is true, another if false.- logical_test
SUMPRODUCT(--ISNUMBER(SEARCH($D$2:$D$4,A2)))>0TRUE - value_if_true
"Escalate" - value_if_false
""not used
- logical_test
In Google Sheets
The same formula works in Google Sheets: =IF(SUMPRODUCT(--ISNUMBER(SEARCH($D$2:$D$4,A2)))>0,"Escalate",""). We ran it in Google Sheets mode on the same data and it returns the same results.
Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =IF(OR(ISNUMBER(SEARCH("refund",A2)),ISNUMBER(SEARCH("cancel",A2)),ISNUMBER(SEARCH("chargeback",A2))),"Escalate","") | Escalate, , 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","") | Escalate, , 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.
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Check if a cell contains one of several words
B2, show "Escalate" when the subject contains any of the keywords in D2:D4, otherwise leave it blank. Fill down to B8.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))).
Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.