2.4 C
London
Friday, December 20, 2024
HomeSoftware TutorialsGoogle SheetsHow to Extract Substring in Google Sheets (With Examples)

How to Extract Substring in Google Sheets (With Examples)

Related stories

Learn About Opening an Automobile Repair Shop in India

Starting a car repair shop is quite a good...

Unlocking the Power: Embracing the Benefits of Tax-Free Investing

  Unlocking the Power: Embracing the Benefits of Tax-Free Investing For...

Income Splitting in Canada for 2023

  Income Splitting in Canada for 2023 The federal government’s expanded...

Can I Deduct Home Office Expenses on my Tax Return 2023?

Can I Deduct Home Office Expenses on my Tax...

Canadian Tax – Personal Tax Deadline 2022

  Canadian Tax – Personal Tax Deadline 2022 Resources and Tools...

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

Subscribe

- Never miss a story with notifications

- Gain full access to our premium content

- Browse free from up to 5 devices at once

Latest stories