The SEARCH function
SEARCH returns the position of some text inside a cell, counting from 1. Unlike FIND, it ignores case and understands wildcards.
It's most useful as a "does this cell contain…?" test. Wrap it in ISNUMBER to get TRUE or FALSE.
=SEARCH(find_text, within_text, [start_num])
Arguments
- find_text
- The text to look for. It can use the wildcards * (any run of characters) and ? (any one character).
- within_text
- The text (or cell) to search in.
- start_numoptional
- The position to start searching from. Leave it out to start at the first character.
Try it
=SEARCH("oak",A2) in B2. SEARCH ignores case, so the lower-case "oak" matches the capital Oak at position 1.
B2
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Product | Oak at | ||
| 2 | Oak Dining Table | 1 | ||
| 3 | Garden bench (oak) | |||
| 4 | Pine Bookcase | |||
| 5 | Kitchen Table, white | |||
| 6 | ||||
| 7 |
Edit the formula in B2, or change the data, and press Enter.
More examples
| Formula | Result | What it does |
|---|---|---|
| =SEARCH("oak",A3) | 15 | The (oak) at the end starts at the 15th character. |
| =ISNUMBER(SEARCH("table",A5)) | TRUE | A contains test: TRUE when the word appears anywhere in the cell. |
| =SEARCH("b?o",A4) | 6 | The ? wildcard matches any one character, so b?o finds Boo in Bookcase. |
| =IFERROR(SEARCH("oak",A4),0) | 0 | Pine Bookcase has no oak, so SEARCH errors and IFERROR shows 0 instead. |
Tips
=ISNUMBER(SEARCH("oak",A2))is the standard way to ask whether a cell contains a word.- To search for a real * or ?, put a tilde in front:
"~*". - Combine with IF to label rows:
=IF(ISNUMBER(SEARCH("oak",A2)),"Oak","Other").
Common mistakes
- SEARCH returns #VALUE! for rows without a match.That's how it says "not found". Wrap it in ISNUMBER for TRUE/FALSE, or IFERROR for a fallback.
- Searching for "oak" also matches "cloak" and "soak".SEARCH matches inside words. Include a space or bracket to be stricter, e.g.
" oak". - You needed upper and lower case to count as different.Use FIND, which is case-sensitive.
Practise SEARCH with instant feedback
Type real formulas into a working spreadsheet and get told straight away whether they work.