What SEARCH does

SEARCH returns the position where one piece of text first appears inside another, ignoring capitals. =SEARCH("refund",A2) returns 18 when A2 says “Customer wants a REFUND”. When the text isn’t there, SEARCH shows #VALUE!, which is what makes it the usual way to check whether a cell contains a word.

Put SEARCH inside ISNUMBER and the answer becomes TRUE when the word is found, at any position, and FALSE when it isn’t. Put that inside IF and you can label rows, as in =IF(ISNUMBER(SEARCH("refund",A2)),"Billing",""), which sends every ticket that mentions a refund to the billing team.

SEARCH also accepts wildcards: ? stands for any one character and * for any run of characters. FIND does the same job with capitals matched exactly and no wildcards.

Syntax

=SEARCH(find_text, within_text, [start_num])
Arguments in square brackets are optional; the rest are required.
find_textRequired
What to look for, such as "refund" or a cell. Capitals don't matter. ? stands for any one character and * for any run of characters; put ~ before one to find a real question mark or asterisk.
within_textRequired
The text to search, usually a cell such as A2.
start_numOptional
The character to start searching from. Leave it out to start at the first. The answer still counts from the start of the text.

Example: send refund tickets to billing

Support tickets come in with a free-text note. Any note that mentions a refund, in any capitals, goes to the billing team. The formula in B2 is filled down to B5.

REFUND, Refund and refund all match, because SEARCH ignores capitals. In B2, =IF(ISNUMBER(SEARCH("refund",A2)),"Billing","") returns Billing.

Read it from the inside out: SEARCH gives a position or #VALUE!, ISNUMBER turns that into TRUE or FALSE, and IF picks the label.

Example: pull an invoice number out of a note

Payment notes mention the invoice somewhere in the text, as INV- and four digits. The wildcard pattern "INV-????" finds it wherever it sits, and MID takes the eight characters from there. The formula in B2 is filled down to B4.

Each ? stands for one character, so the pattern matches INV- and any four characters after it. In B2, =MID(A2,SEARCH("INV-????",A2),8) returns INV-2081.

SEARCH ignores capitals, so it finds inv-2094 too. MID returns the characters as they’re written in the note.

Check if a cell contains text

The pattern ISNUMBER(SEARCH(...)) answers “does this cell contain this word?” anywhere a formula needs a TRUE or FALSE:

  • =ISNUMBER(SEARCH("late",B2)) on its own returns TRUE or FALSE.
  • =IF(ISNUMBER(SEARCH("late",B2)),"Follow up","") shows a label.
  • =OR(ISNUMBER(SEARCH({"refund","chargeback"},A2))) returns TRUE when A2 mentions either word.
  • =COUNTIF(A2:A50,"*refund*") counts the cells that contain the word, with the asterisks standing for any text before and after it.

When the capitals matter, as with a code like PO, use FIND in place of SEARCH.

Common mistakes

  • =IF(SEARCH("refund",A3),"Billing","") shows #VALUE! on every row without the word, because the error from SEARCH passes straight through IF. Put ISNUMBER around SEARCH.
  • =IF(A2="*refund*","Billing","") never matches: an equals sign compares the whole cell and doesn’t read wildcards. Use SEARCH, or COUNTIF, which does.
  • A short word also matches inside longer ones: =SEARCH("art",A2) finds the art in “Restart the server”. Search for something more specific, or include the space before it, as in " art".
  • To find an actual question mark or asterisk, put a tilde in front of it: =SEARCH("~?",A2). Without the tilde, "?" matches any character.

Frequently asked questions

How do I check if a cell contains specific text in Excel?

Use =ISNUMBER(SEARCH("text",A2)), which returns TRUE when A2 contains the text in any capitals. Inside IF it can show a label: =IF(ISNUMBER(SEARCH("text",A2)),"Yes","No").

What is the difference between SEARCH and FIND?

SEARCH ignores capitals and accepts the wildcards ? and *. FIND matches capitals exactly and has no wildcards. Both return the position of the first match or #VALUE!.

Can SEARCH use wildcards?

Yes. ? stands for any one character and * for any run of characters, so "INV-????" finds INV- followed by four characters. Put ~ before a ? or * to find the character itself.

How do I search for several words at once?

Give SEARCH the words in curly braces and wrap it in OR and ISNUMBER: =OR(ISNUMBER(SEARCH({"refund","chargeback"},A2))) returns TRUE when A2 contains either word.

Why does SEARCH return #VALUE!?

The text isn’t in the cell, so there’s no position to return. That’s expected for rows without a match: wrap SEARCH in ISNUMBER to get FALSE instead, or in IFERROR to show something else.