Function Problems

Extract Text Before or After a Word in Excel

Emma BrownEmma Brown Nov 20, 2026 869 views

Question details

Extract the text before or after a specific word in an Excel cell.

Extract Text Before or After a Word in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A user wants to split review text around a delimiter such as the word By.
Observed behavior
The desired result is the text on either side of the first occurrence of the delimiter.
Before you start

Identify the cell containing the text and check the exact spelling and capitalization of the delimiter. The examples below use cell A1 and the delimiter By.

Solution 1Recommended

Use LEFT, MID, and FIND to extract the text

Use formulas to return the text on either side of the first matching delimiter.

FIND is case-sensitive and matches the characters wherever they appear, including inside another word. If your delimiter is different, replace By in the formulas and change +2 to the number of characters in that delimiter.

1
Extract text before By

Select an empty cell, enter =LEFT(A1,FIND("By",A1)-1), and press Enter.

2
Extract text after By

Select another empty cell, enter =MID(A1,FIND("By",A1)+2,LEN(A1)), and press Enter.

3
Apply the formulas to other rows

Select each formula cell and drag its fill handle down alongside the remaining reviews.

Use LEFT, MID, and FIND to extract the text
Handle missing delimiters: If some cells do not contain By, wrap a formula in IFERROR to return a blank instead of an error. For example, use =IFERROR(LEFT(A1,FIND("By",A1)-1),"").
Extract text in WPS Spreadsheets

Extract Text Around a Word in WPS Spreadsheets

Use FIND with LEFT or MID in WPS Spreadsheets to extract the text before or after a delimiter in your worksheet.

  1. 1. Open your worksheet: Open WPS Spreadsheets and choose Open to select your workbook.
  2. 2. Extract the first part: In an empty cell, enter =LEFT(A1,FIND("By",A1)-1) to return the text before By.
  3. 3. Extract the second part: In another empty cell, enter =MID(A1,FIND("By",A1)+2,LEN(A1)) to return the text after By.
  4. 4. Fill the formulas down: Select each formula cell and drag its fill handle down to apply it to other rows.
Extract text on either side of a delimiter with familiar formulasOpen and edit Microsoft Excel XLSX and XLS filesUse a free spreadsheet editor with a familiar interface
QA img-9

Frequently Asked Questions

How do I return a blank if the word is missing?

Wrap the extraction formula in IFERROR. For example, enter =IFERROR(MID(A1,FIND("By",A1)+2,LEN(A1)),"") to return a blank when By is not found.

Can I use a different delimiter?

Yes. Replace By inside FIND with your delimiter. In the MID formula, replace +2 with the number of characters in the new delimiter.

Does FIND distinguish between By and by?

Yes. FIND is case-sensitive, so FIND("By",A1) will not match lowercase by. Use the exact capitalization in your data.

How can I remove extra spaces from the extracted text?

Wrap the extraction formula in TRIM. For example, enter =TRIM(LEFT(A1,FIND("By",A1)-1)) to remove leading and trailing spaces from the result.