Extracting the First N Number of Words from a String in Excel

This article is about how to extract the first N number of words from a string in Microsoft Excel by using formulas. To solve this problem we will use TRIM, LEFT, FIND and SUBSTITUTE functions.

Let's see why we will use all of above mentioned formulas:-

FIND function helps to return the placed number at which a specific character or text string is first found.

LEFT function return the specified character from the defined cells from the left side of the string.

TRIM function is used to remove extra spaces from the cell or range.

SUBSTITUTE function is used to replace the old text with new text.


Let’s take an example to understand how we can extract all text before the tilde symbol (^).

This symbol appears at different locations in each string.

Example 1: We have a list in column A. We want to extract all text before the tilde (^) symbol whether it is text, number or symbols.  In this case, the number of characters we have to extract for each row vary.  It’s the same as extracting “N” number of words from a string, as the “N” can vary from string to string.


Follow below given steps:-

  • Select the Cell B2, write the formula.
  • =TRIM(LEFT(A2,FIND("^",SUBSTITUTE(TRIM(A2)&" "," ","^",3))-1))
  • Press Enter on your keyboard.
  • The function will return the first N number.


  • To Copy the formula in all cells, press the key  “CTRL + C”  and select the cell B3:B4 and press the key “CTRL + V” on your keyboard.


This is how we can extract a variable number of characters from a string in Microsoft Excel.


image 48


If you liked our blogs, share it with your friends on Facebook. And also you can follow us on Twitter and Facebook.
We would love to hear from you, do let us know how we can improve, complement or innovate our work and make it better for you. Write us at info@exceltip.com



Leave a Reply

Your email address will not be published. Required fields are marked *

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.