Extract Text Before or After a Word in Excel
Question details
Extract the text before or after a specific word in an Excel cell.

- 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.
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.
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.
Select an empty cell, enter =LEFT(A1,FIND("By",A1)-1), and press Enter.
Select another empty cell, enter =MID(A1,FIND("By",A1)+2,LEN(A1)), and press Enter.
Select each formula cell and drag its fill handle down alongside the remaining reviews.

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. Open your worksheet: Open WPS Spreadsheets and choose Open to select your workbook.
- 2. Extract the first part: In an empty cell, enter =LEFT(A1,FIND("By",A1)-1) to return the text before By.
- 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. Fill the formulas down: Select each formula cell and drag its fill handle down to apply it to other rows.

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.




