SEARCH Function - Excel


Overview


The SEARCH function in Excel is a useful tool for locating the position of a specific character or substring within a text string when it first appears. This function is case sensitive when looking for a particular character or substring within a given text and spaces are counted as a character.

An example of the SEARCH function in Excel

Example:

=SEARCH("a", "Cake")

Syntax:

=SEARCH(find_text, within_text, [start_num])

find_text: This is the text you want to find within the within_text.

within_text: This is the text string in which you want to search for find_text. If omitted, the search starts from the beginning.

[start_num]: (Optional) This is the starting position for the search within


Example: Specific Character


In this example, the SEARCH function returns the value 3 because the “n” character appears for the first time at the 3rd position in the word “running”.

An example of the SEARCH function in Excel with a specific character

Example: Substring


In this example, the SEARCH function returns the value 11 because the “dog” substring is not found until the start of the 11th position in the “the three dogs” text.

An example of the SEARCH function in Excel with a substring

Example: start_num


In this example, I'll demonstrate how we can use the optional [start_num] input in the SEARCH function. We have the word “banana” and we are looking for the first occurrence of the letter “a” in that word, however this time we are asking the function to only start looking for the letter “a” on or after the 5th position in the word “banana”. The next time that the letter “a” appears is in the 6th position which is why we get an output of 6.

An example of the SEARCH function in Excel with the optional start_num input

Interactive GSheet