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

Add to Favorites
Author: | Edits: don

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)
Argument Description
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 1, Excel File 2

Question? Ask it in our Excel Forum

Our Excel Courses

  • Skill Level: All Levels
  • |
  • 5 hours+

How to make a fully featured professional form in Excel that is unbreakable. This includes how to use the form to store, view, edit, and delete data from a data storage worksheet.

  • Skill Level: All Levels
  • |
  • 2 hours

Send Emails from Excel using VBA and Macros. This course starts from the Basics and builds up to more advanced examples with attaching workbooks, worksheets, PDF's, automatically sending emails, including a signature, error handling, increasing speed, and more.

Similar Content on TeachExcel
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...
Simple Excel Function to Combine Values in All Versions of Excel - UDF
: Excel function that combines values from multiple cells or inputs using a delimiter - work...
Formulas to Remove First or Last Character from a Cell in Excel
Tutorial: Formulas that allow you to quickly and easily remove the first or last character from a ce...
Logical Comparison Operators in Excel - How to Compare Things
Tutorial: (Video tutorial's page: Compare Values in Excel - Beginner to Advanced) Logical compariso...
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...
SUBSTITUTE() Function - Change Specific Text within a Cell in Excel
Tutorial: Change or replace text in a cell with other text - you can replace a single character, num...