Google Sheets SEARCH Function

This post will guide you how to use Google Sheets SEARCH function with syntax and examples.

Description


The Google Sheets SEARCH function returns the number of the starting location of a substring in a text string. You can use the SEARCH function to locate a text string within another text string and returns the position of the first character of find_text within text.

The SEARCH function can be used to calculate the position at which a string is first found within text in google sheets.  The purpose of this function is to get the location of text in the given string. And it’s returned value as a number representing the location of finding text.

The SEARCH function is a build-in function in Google Sheets and it is categorized as a Text Function.

Syntax


The syntax of the SEARCH function is as below:

= SEARCH (find_text, within_text,[start_num])

Where the SEARCH function arguments are:

  • find_text -This is a required argument. The substring that you want to find
  • within_text -This is a required argument. The text string in which you want to search for the substring (find_text).
  • Start_num -This is an optional argument. The starting position to search.

Note:

  • The SEARCH function will return the position of a find_text inside another text string. And if there is more than one occurrence of the find string, and the SEARCH function returns the position of the first occurrence.
  • If find_text string is not found, the search function will return the #VALUE! Error value.
  • When find text string is empty, the SEARCH function will return 1.
  • If start_num value is omitted, it is set to be 1 by default.
  • The SEARCH function is not case-sensitive. For example, “google” will match “GOOGLE”. If you wish to compare text where case matters, and you can use the FIND function.
  • The SEARCH function support wildcard characters.
  • you can use another function called IFERROR function in combination with the SEARCH function to check for cases when there are any matches to the search.

Google Sheets SEARCH Function Examples


The below examples will show you how to use google sheets SEARCH function to get the position of substring in a text string.

#1 To get the position of “google” text string in B1 cell, starting at the second position, just using formula:

=SEARCH(“google”,B1,2) //it returns 7

google sheets search function

#2 The search function use wildcard characters to look for a string starts with “go” characters in cell B1, using the following formula:

=SEARCH(“go*”,B1,1) //it returns 7

google sheets search function

#3 #VALUE! Error will be returned if find_text string is not found in with_text:

=SEARCH(“test”,”google”,1)   //it returns #VALUE!

google sheets search function