Simple Excel Function to Extract a Word or Text from a Cell

Add to Favorites

Excel function that makes it easy to extract a word or text from a cell in Excel.

This is a single function!

It does NOT require a complex formula or nested functions or anything like that.

To use this function, we first need to create it using a UDF, User Defined Function. You can learn about this kind of function here: User Defined Functions in Excel



Create the Function and Install It

Function Examples



(UDF code for this function listed in the next section)

=Get_Word(input_data, delimiter, word)

Input_data The cell or text from which you want to get a word or text.

The character that separates your text. In a sentence, this would be a space. It could be a dash, for things like part numbers, or, really, anything that separates your text into individual sections or elements. If the value in here is not a number, it must be surrounded with double quotation marks "".


This is a number. The number is which word or individual section you want to get from the text. 1 means get the first word/section in the cell; 2 means get the second word/section in the cell, etc.


Create the Function and Install It

(If you do not know about UDFs, please visit the link at the top of this tutorial. Here, I assume you know what they are.)

Here is the UDF code:

Function Get_Word(input_data, delimiter, word)


    'make input number more friendly for users

    word = word - 1


    input_data = Split(input_data, delimiter)


    Get_Word = input_data(word)


End Function

I only included one comment above because the rest of the code is self-explanatory, if you know VBA, and, if you don't know VBA, it doesn't really matter, because it works already.

Copy/past the above code into a module in the VBA Editor (Alt + F11 and then Insert > Module) and then go back to Excel and we can begin to use it.

Function Examples

Get a Word

Here is our sample:

Let's get is from this sentence using our new function.

Notice that the second argument is a blank space surrounded by double quotation marks. This is because a space is what separates the individual parts of text in cell A1.

The third argument is 2, which says that we want to get the second word from that cell, which will be is.


Get a Part Number

This follows the same pattern as above.

Sample data:

I want to get the number 234 from this cell.

Here, the delimiter is a dash and, of course, it needs to be surrounded with double quotation marks.

The 2 in the third argument means to get the second word or element from the cell. The function breaks the original cell into parts based on the delimiter that you enter and you just need to tell Excel which part you want to get back.



This is a great UDF. I love how simple it is to use and how easily it does something you expect Excel to do.

If you didn't understand everything in this tutorial, please read the UDF tutorial that is linked to at the top of this tutorial. That will get you up-to-speed on how these types of custom functions work in Excel.

Make sure to download the sample file attached to this tutorial so you can test it out and get the code.

Downloadable Files: Excel File

Similar Content on TeachExcel
Excel Data Validation - Limit What a User Can Enter into a Cell
Tutorial: Data Validation is a tool in Excel that you can use to limit what a user can enter into a...
Simple Excel Function to Combine Text with a Separator
Tutorial: Excel function that makes combining text very easy. This function is simpler and better th...
Make Users Enable Macros in Order to View a Workbook in Excel
Tutorial: Tutorial showing you how to make a user enable macros in a workbook in order to view the ...
Get the First Word from a Cell in Excel
Tutorial: How to use a formula to get the first word from a cell in Excel. This works for a single c...
Round Numbers Up or Down in Excel
Tutorial: How to round a number up or down and also to a specified number of decimal places in Excel...
Transpose a Column into Multiple Rows in Excel
Tutorial: Convert a column of data into multiple rows of data at a given interval. For instance, e...