ElyxAI
formulas

How to How to Extract nth Word from Text String in Excel

Shortcut:Ctrl+Shift+Enter (for array formulas in Excel 2019 and earlier)
Excel 2016Excel 2019Excel 365

Learn to extract the nth word from any text string in Excel using formulas. This tutorial covers multiple methods including TRIM, MID, FIND, and FILTERXML to isolate specific words by position, enabling efficient data parsing and text manipulation for reports and data cleaning tasks.

Why This Matters

Extracting specific words from text is essential for data cleaning, parsing names, addresses, and automating text analysis without manual editing.

Prerequisites

  • Basic understanding of Excel functions and cell references
  • Familiarity with text functions like LEN and FIND
  • Knowledge of array formulas or ability to use helper columns

Step-by-Step Instructions

1

Prepare Your Data

Enter your text string in a cell (e.g., A1). For example, input 'The Quick Brown Fox Jumps' to extract specific words from this phrase.

2

Choose Your Method: FILTERXML (Easiest for Excel 365)

In cell B1, enter the formula: =TRIM(FILTERXML("<t><s>"&SUBSTITUTE(A1," ","</s><s>")&"</s></t>","//s["&n&"]")) where n is the word position (1st, 2nd, etc.).

3

Alternative: Use TRIM + MID + FIND Method

Enter this formula in B1: =TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",100)),(n-1)*100+1,100)) where n is the word number you want to extract.

4

Test with Word Position

Replace n with the word position (e.g., for 2nd word use n=2). Press Enter and verify the correct word appears in the cell.

5

Copy Formula Down for Multiple Rows

Click the cell containing your formula, then drag the fill handle down to apply it to all rows in your dataset.

Alternative Methods

REGEX Method (Excel 365 only)

Use REGEX function with pattern matching to extract words: =REGEX(A1,"\w+",n). This is the most flexible method for complex text patterns.

Text to Columns with Helper Columns

Split text using Data > Text to Columns > Delimited > Space, then reference the desired column. Best for one-time splits rather than formulas.

VBA Macro Solution

Create a custom VBA function for reusable word extraction across multiple workbooks. Requires enabling macros and coding knowledge.

Tips & Tricks

  • Use absolute references ($A$1) when copying formulas across rows to prevent formula changes.
  • Add error handling with IFERROR() to display a blank or custom message if the word doesn't exist.
  • Trim extra spaces in source data first using Data > Text to Columns to avoid extraction errors.

Pro Tips

  • Combine with COUNTIF to validate word count before extraction to prevent #VALUE! errors.
  • Use nested SUBSTITUTE with increasing spaces to handle variable gaps between words reliably.
  • Create a dynamic formula that extracts the nth word for any position without hardcoding the number.

Troubleshooting

Formula returns #VALUE! error

Check that the word position exists in the text string. Use =IFERROR(formula,"Word not found") to handle missing words gracefully.

Extraction gives wrong word

Verify spacing is consistent; use TRIM(SUBSTITUTE()) to normalize all spaces to single spaces between words.

Formula works in one row but not others

Ensure cell references are relative (A1, not $A$1) so they adjust when copying down, or use appropriate absolute references.

Related Excel Formulas

Frequently Asked Questions

Can I extract the nth word without helper columns?
Yes, use single formulas like FILTERXML or the TRIM+MID+FIND combination directly in one cell. These don't require additional columns and work efficiently even with large datasets.
What's the best method for Excel 2016 vs Excel 365?
Excel 365 users should use FILTERXML or REGEX for simplicity. Excel 2016 and earlier versions work best with TRIM+MID+FIND or Text to Columns approach.
How do I extract multiple nth words (e.g., words 2 and 3)?
Create separate formulas for each word position, or use a more complex formula that returns all extracted words concatenated. For example, repeat the FILTERXML formula with different position numbers.
Can this work with punctuation attached to words?
Yes, but use SUBSTITUTE to remove punctuation first: =SUBSTITUTE(A1,",","") then apply the extraction formula to clean results.

This was one task. ElyxAI handles hundreds.

Sign up