The SEARCH function in Google Sheets is a powerful tool used to find the position of a substring within a given text. This function is particularly useful when you need to locate specific data points within larger datasets or text strings, making it essential for data analysis and text processing tasks.
Syntax
SEARCH(search_for, text_to_search, [starting_at])
- search_for: The substring you are looking for within the text.
- text_to_search: The text string where you seek the substring.
- [starting_at]: (Optional) The position in the text to start the search. Default is 1.
Example #1
SEARCH("cat", "The black cat sat on the mat")
This function will return 11, as “cat” first appears at the 11th position in the text string.
Example #2
SEARCH("o", "Google Sheets")
This function will return 5, indicating that the letter “o” first appears at the 5th position in the text “Google Sheets.”
Example #3
SEARCH("&", "Data & Analysis")
In this case, the function will return 6, as the ampersand (&) appears at the 6th position in the text.
Error handling
- VALUE! This error occurs when the search_for parameter is not found in the text_to_search.
- N/A This indicates that the substring was not found starting from the specified starting_at position.