SEARCH function
SEARCH finds where one piece of text appears inside another and returns its position. It ignores case and allows wildcards, making it the forgiving cousin of FIND.
Example
Read it as a sentence: find where the letter C first appears in abc, ignoring capitals, which gives 3.
A
B
C
D
1
3
2
3
Syntax
SEARCH(find_text, within_text, [start_num])
Arguments in [square brackets] are optional.
-
find_text(required) - The text to find; ? and * wildcards are allowed.
-
within_text(required) - The text to search in.
-
start_num(optional) - Position to begin; default 1.
Returns: The position of the first match, or #VALUE!.
What Excel actually returns
Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.
| Formula | Excel shows | Case |
|---|---|---|
=SEARCH("B","abc") | 2 | Case-insensitive |
=SEARCH("b?","abc") | 2 | Wildcard ? |
=SEARCH("*c","abc") | 1 | Wildcard * |
=SEARCH("~?","a?c") | 2 | Escaped ? |
=SEARCH("","abc") | 1 | Empty find text |
=SEARCH("a","abca",2) | 4 | Start position |
=SEARCH("z","abc") | #VALUE! | Not found |
=SEARCH("a","abc",0) | #VALUE! | Start 0 |
Watch out for
- Case-insensitive.
- Use ~ before ? or * to search for those literally.
Where it works
- Excel
- SEARCH is in every version of Excel from 2007 on.
- Google Sheets
- Same name, same behaviour for everyday use.
Part of Text functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .