Spreadsheet Practice

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 to B8
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"

  1. $D$2:$D$43 rows × 1 col: "refund", "cancel", "chargeback"

    A range: 3 cells in one column.

  2. A2"Please refund my order"

    The value in A2.

  3. 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_textA2"Please refund my order"
  4. ISNUMBER(SEARCH($D$2:$D$4,A2)){3 rows × 1 col} TRUE, FALSE, FALSE

    ISNUMBER: TRUE if the value is a number.

    • valueSEARCH($D$2:$D$4,A2){3 rows × 1 col} 8, #VALUE!, #VALUE!
  5. -ISNUMBER(SEARCH($D$2:$D$4,A2)){3 rows × 1 col} -1, 0, 0

    Makes the value negative.

  6. --ISNUMBER(SEARCH($D$2:$D$4,A2)){3 rows × 1 col} 1, 0, 0

    Makes the value negative.

  7. SUMPRODUCT(--ISNUMBER(SEARCH($D$2:$D$4,A2)))1

    SUMPRODUCT: Multiplies arrays row by row and adds the results.

    • array1--ISNUMBER(SEARCH($D$2:$D$4,A2)){3 rows × 1 col} 1, 0, 0
  8. SUMPRODUCT(--ISNUMBER(SEARCH($D$2:$D$4,A2)))>0TRUE

    The > operator tests greater than.

  9. 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_testSUMPRODUCT(--ISNUMBER(SEARCH($D$2:$D$4,A2)))>0TRUE
    • value_if_true"Escalate"
    • value_if_false""not used

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.

FormulaResultWhen 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

In 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.