How to Extract Text Before or After Character in Excel and Google Sheets
Download the example workbook
This tutorial will demonstrate how to extract text before or after a character in Excel and Google Sheets.
Extract Text Before Character using the FIND and LEFT Functions
To extract the text before the comma, we can use the LEFT and FIND functions
First, we can find the position of comma by using the FIND function and then subtract one to the value returned to get the length of the Last Name.
Use LEFT Function
We then use the left function to extract the text before the position returned by the FIND function above.
Combining these functions yields the formula:
=LEFT(B3, FIND(",", B3)-1)
Extract Text After Character using the FIND, LEN and RIGHT Functions
In the next section, we will use the FIND, LEN and RIGHT Functions to extract the text after a specific character in a text string.
As we did in the previous example, we use the find Function to find the position of the comma and then subtract one to the value returned to get the length of the Last Name.
We then use the LEN Function to get the total length of the text
We can then combine the FIND and the LEN functions to get the amount of characters we want to extract after the comma
Finally we use the RIGHT function to return the characters after the comma in the cell.
Combining these functions yields this formula:
Extract Text Before Character using the FIND and LEFT Functions in Google Sheets
You can extract text before a character in Google sheets the same way you would do so in Excel.
Extract Text After Character using the FIND, LEN and RIGHT Functions in Google Sheets
Similarly, to extract text after a character is also the same in Google Sheets.