Log in  \/ 
x
or
x
x
Register  \/ 
x

or

Extract word beginning with a specific character in Excel

For example, you may need to extract the word which begins with a specific character “=” for each cell as below screenshot shown, how could you solve this task quickly and easily in Excel?


Extract word beginning with a specific character in Excel

To extract the words that begin with a specific character or text from each cell, you can create a formula with a combination of TRIM, LEFT, SUBSTITUTE, MID, FIND, LEN and REPT functions, the generic syntax is:

=TRIM(LEFT(SUBSTITUTE(MID(text, FIND(char, text), LEN(text))," ",REPT(" ",LEN(text))),LEN(text)))
  • text: The text string or cell value that you want to extract word from.
  • char: The character or text that you want to extract word begins.

1. Please copy or enter the following formula into a blank cell:

=TRIM(LEFT(SUBSTITUTE(MID(A2, FIND("=",A2), LEN(A2))," ",REPT(" ",LEN(A2))),LEN(A2)))

2. Then, drag the fill handle down to apply the formula to the cells that you want to use, and all the words begin with the specific “=” character have been extracted at once, see screenshot:


Explanation of the formula:

1. MID(A2, FIND("=",A2), LEN(A2):

  • LEN(A2): This LEN function returns the number of the characters in cell A2. This part is recognized as the num_char argument in the MID function.
  • FIND("=",A2): This FIND function is used to get the position of the first specific character “=” in cell A2. This part is recognized as the start_num argument in the MID function.
  • MID(A2, FIND("=",A2), LEN(A2): This MID function is used to extract a substring from cell A2 at the position which returned by the FIND function and specific length returned by the LEN function.

2. SUBSTITUTE(MID(A2, FIND("=",A2), LEN(A2))," ",REPT(" ",LEN(A2))):

  • REPT(" ",LEN(A2): The REPT function repeats empty string of cell A2 a specific number of times returned by the LEN function.
  • SUBSTITUTE(): This SUBSTITUTE function will replace all empty string with another new text-multiple spaces returned by the REPT function from a text string returned by the MID function.
  • MID(A2, FIND("=",A2), LEN(A2): This MID function is used to extract a substring from cell A2 at the position which returned by the FIND function and specific length returned by the LEN function.

3. LEFT(SUBSTITUTE(MID(A2, FIND("=",A2), LEN(A2))," ",REPT(" ",LEN(A2))),LEN(A2)):This LEFT function is used to extract the specific number of characters returned by the LEN function from left side of the text string returned by the SUBSTITUTE function.

4. TRIM():The TRIM function remove all extra spaces from text string returned by the LEFT function.


Notes:

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 begin 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.
  • SUBSTITUTE:
  • 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.
  • LEN:
  • The LEN function returns the number of characters in a text string.
  • REPT:
  • The REPT function is used to repeat the characters a specified number of times.
  • FIND:
  • The FIND function is used to find a string within another string, and returns the starting position of the string inside another one.

More articles:

  • 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 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 Multiple Lines From A Cell
  • If you have a list of text strings which are separated by line breaks (that occurs by pressing Alt + Enter keys when entering the text), and now, you want to extract these lines of text into multiple cells as below screenshot shown. How could you solve it with a formula in Excel?

The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save 80% time for you.

  • Designed for 1500 work scenarios, helps you solve 80% Excel problems.
  • Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
  • Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
  • 30-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.
Ribbon of Excel (with Kutools for Excel installed)

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, Firefox, And New Internet Explorer.
Screen Shot of Excel (with Office Tab installed)
Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.