How to Extract Substring in Google Sheets (With Examples)


You can use the following formulas to extract certain substrings from text in Google Sheets:

Method 1: Return Substring from Beginning of String

#return first 4 characters of string in cell A1
=LEFT(A1, 4)

Method 2: Return Substring from Middle of String

#return 4 characters of string in cell A1 starting at position 2
=MID(A1, 2, 4)

Method 3: Return Substring from End of String

#return last 4 characters of string in cell A1
=RIGHT(A1, 4)

Method 4: Return Substring Before Certain Text

#return all text before the string "there" in cell A1
=LEFT(A1, SEARCH("there", A1)-1)

Method 5: Return Substring After Certain Text

#return all text after the string "there" in cell A1
=RIGHT(A1, SEARCH("there", A1)-1)

The following examples show how to use each of these methods in practice.

Method 1: Return Substring from Beginning of String

The following screenshot shows how to use the LEFT() function to return the first three characters from cell A2:

Method 2: Return Substring from Middle of String

The following screenshot shows how to use the MID() function to return the five characters in the middle of cell A2, starting at position 4:

Method 3: Return Substring from End of String

The following screenshot shows how to use the RIGHT() function to return the last three characters from cell A2:

Method 4: Return Substring Before Certain Text

The following screenshot shows how to use the LEFT() and SEARCH() functions to return all of the text that comes before the string “there” in cell A2:

Method 5: Return Substring After Certain Text

The following screenshot shows how to use the RIGHT() and SEARCH() functions to return all of the text that comes after the string “there” in cell A2:

Additional Resources

The following tutorials explain how to perform other common operations in Google Sheets:

How to Round to Significant Figures in Google Sheets
How to Select a Random Sample in Google Sheets
How to Combine Columns in Google Sheets

Leave a Reply

Your email address will not be published.