Skip to main content

Extract word which containing specific text in Excel

Sometimes, you may want to extract the word from a cell that contains a specific character or text, such as following screenshot shown, to extract all words that containing the “=” character. How could you solve this task in Excel?

Extract word which containing a specific character or text

To solve this problem, you should create a formula which combines the TRIM, MID, SUBSTITUTE, REPT, MAX and FIND functions. The generic syntax is:

=TRIM(MID(SUBSTITUTE(string," ",REPT(" ",99)),MAX(1,FIND(char,SUBSTITUTE(string," ",REPT(" ",99)))-50),99))
  • string: The text string or cell value that you want to extract word inside.
  • char: The character or text that you want to extract word contains.

1. Please enter or copy the following formula into a blank cell where you want to get the result:

=TRIM(MID(SUBSTITUTE(A2," ",REPT(" ",99)),MAX(1,FIND("=",SUBSTITUTE(A2," ",REPT(" ",99)))-50),99))

2. Then, drag and copy the formula to the cells that you want to use, and you will get the following result:

Explanation of the formula:
  • SUBSTITUTE(A2," ",REPT(" ",99)): This SUBSTITUTE function will replace each single space with 99 spaces which are returned by the REPT function, and get a new text string with multiple spaces between each word. The number 99 is just an arbitrary number that represents the longest word you need to extract.
  • FIND("=",SUBSTITUTE(A2," ",REPT(" ",99)))-50: This FIND function is used to find the position of the first specific character (in this case, “=”) inside the new text string returned by the SUBSTITUTE function.
  • MAX(): If the substring appears in the front of the text string, the FIND function will get a negative number, and this MAX function is used to reset the negative value to 1.
  • MID(SUBSTITUTE(A2," ",REPT(" ",99)),MAX(1,FIND("=",SUBSTITUTE(A2," ",REPT(" ",99)))-50),99): This MID function is used to extract 99 characters from the text string which is returned by the SUBSTITUTE function at a specific position that returned by the FIND function.
  • TRIM(): This TRIM function removes all extra spaces from text string returned by the MID function.


1. In the above formula, you can change the “=” character to any other character or text you need.

2. If there are multiple words which contain the specific character, only the first word will be extracted.

Relative functions used:

  • REPT:
  • The REPT function is used to repeat the characters a specified number of times.
  • The SUBSTITUTE function replaces text or characters within a text string with another text or characters.
  • TRIM:
  • The TRIM function removes all extra spaces from text string and only keeps single spaces between words.
  • MID:
  • The MID function returns the specific characters from the middle of text string.
  • MAX:
  • The MAX function returns the largest numeric value in a range of values.

More articles:

  • Extract Text Between Parentheses From Text String
  • If there is part of the text surrounded with the parentheses within the text string, now, you need to extract all the text strings between the parentheses as following screenshot shown. How could you solve this task in Excel quickly and easily?
  • Extract Last Line Of Text From A Multi-Line Cell
  • To extract the last line of text from a text string which is separated by line breaks, normally, there is no direct way for you to solve this. This article, I will introduce a formula to deal with this task in Excel.

The Best Office Productivity Tools

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.
Comments (2)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
J'ai le même problème que Pierre, le "FIND" n'existe pas sur mon excel.
This comment was minimized by the moderator on the site
Leider erkennt Excel die Formel nicht und deklariert sie als invalid!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations