How to Extract Substring in Google Sheets

To extract a substring in Google Sheets, you can use various functions like LEFT, RIGHT, MID, and REGEXEXTRACT. These functions allow you to extract specific parts of a text string based on the position or a pattern.

Here are the instructions for using some of these functions:

  1. LEFT function: The LEFT function extracts a substring from the beginning of a text string.

Syntax: =LEFT(text, [num_chars])

  1. RIGHT function: The RIGHT function extracts a substring from the end of a text string.

Syntax: =RIGHT(text, [num_chars])

  1. MID function: The MID function extracts a substring from a specific position within a text string.

Syntax: =MID(text, start_position, num_chars)

  1. REGEXEXTRACT function: The REGEXEXTRACT function extracts a substring based on a regular expression pattern.

Syntax: =REGEXEXTRACT(text, regular_expression)

Example

Let's say we have the following text string in cell A1: Google Sheets is amazing!

  1. Extract the first 6 characters using the LEFT function: =LEFT(A1, 6) - this will return Google.
  2. Extract the last 8 characters using the RIGHT function: =RIGHT(A1, 8) - this will return amazing!.
  3. Extract 5 characters starting from the 8th character using the MID function: =MID(A1, 8, 5) - this will return Sheet.
  4. Extract the word between "Google" and "is" using the REGEXEXTRACT function: =REGEXEXTRACT(A1, "Google (.+?) is") - this will return Sheets.
Did you find this useful?