SEARCH function is used when you want to locate a text string within another text string and find its position in both Excel & Google Sheet.
It returns a number that represents the starting position of the string you are looking for, in another string.
=SEARCH(search_text, within_string, [start_num])
- search_text – the text or string that you need to search.
- within_string – the string within which you want to search the search_text argument.
- [start_num] – the number that represents the position from which you want the search to begin. If you omit it, it starts searching from the beginning.
In below example we used SEARCH function to find the text “Search” in the string in cell A2. Since SEARCH function is case insensitive and start number is not specified here, it returned 12 which is the starting position of the first “SEARCH” keyword.
In below example we have used SEARCH function to search the wildcard character “#”
In the next example we are again searching the text “SEARCH” starts from 16th position in the string in A2. Since SEARCH function is case insensitive, the case of the search text doesn’t matter. It returned 31 which is the starting position of text “search” which is after the 16th character in the string in A2.
- SEARCH function is not case-sensitive. If you would like to do a case-sensitive search, use FIND function.
- SEARCH function can be used to search wildcard characters as well.
- It returns error if the searched text is not found in the string.