Extract the Nth Word from Text

Excel Formulas › Text

All versionsTRIMMIDSUBSTITUTE

To pull out just the 2nd word (or 3rd, or last) from a phrase — a middle name, a street name, a status code — the classic SUBSTITUTE + REPT + MID trick works in every version, no TEXTSPLIT required.


Quick formula: to grab word number N from A2:
=TRIM(MID(SUBSTITUTE(A2," ",REPT(" ",100)), (N-1)*100+1, 100))
It pads every space to 100 spaces, then slices a 100-character window at the right spot — TRIM cleans the result.

Functions used (tap for the full reference guide):

The example

Pulling the 2nd word from each phrase.

AB
1Phrase2nd word
2the quick brown foxquick
3red blue greenblue

The formula

The 2nd word (N = 2):

=TRIM(MID(SUBSTITUTE(A2," ",REPT(" ",100)), (2-1)*100+1, 100)) // "the quick brown fox" → "quick"

How it works

The trick spaces the words far apart, then takes a fixed slice:

  1. SUBSTITUTE(A2," ",REPT(" ",100)) replaces each single space with 100 spaces, spreading the words wide apart.
  2. MID(…, (N-1)*100+1, 100) grabs a 100-character window starting where word N now sits.
  3. That window contains word N surrounded by padding spaces; TRIM strips the padding, leaving the word.
  4. Change N to pick any word; it works regardless of how long the words are.

Excel 365 is simpler: =TEXTBEFORE(TEXTAFTER(A2," ", N-1), " ") gets the Nth word, and =INDEX(TEXTSPLIT(A2," "), N) is even cleaner. The REPT trick is for when you don’t have those.

Try it: interactive demo

Live demo

Type a phrase and pick a word number.

Word:

Variations

Excel 365 way

Index into a split:

=INDEX(TEXTSPLIT(A2, " "), N)

First word

Everything before the first space:

=TEXTBEFORE(A2, " ")

Last word

After the final space:

=TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",100)), 100))

Pitfalls & errors

Words longer than 100 characters would overflow the window. Bump the REPT count up (e.g. 200) for very long words — rare, but possible.

Multiple spaces between words can shift the count. TRIM the source first: replace A2 with TRIM(A2).

Asking for a word that isn’t there returns blank or padding. Guard with IF(N≤word count) if needed.

Practice workbook

📊
Download the free Extract the Nth Word from Text practice workbook
Phrases with the live REPT/MID nth-word formula, the 365 TEXTSPLIT and first/last-word variants, plus 4 challenges with answers. No sign-up required.

Frequently asked questions

How do I extract the nth word from a cell in Excel?
Use =TRIM(MID(SUBSTITUTE(A2," ",REPT(" ",100)), (N-1)*100+1, 100)). It spaces the words far apart, slices a fixed window at word N, and trims the padding. Works in every version.
Is there an easier way in Excel 365?
Yes: =INDEX(TEXTSPLIT(A2," "), N) returns the nth word directly, or =TEXTBEFORE(TEXTAFTER(A2," ", N-1), " ").
How do I get the last word?
Use =TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",100)), 100)), which takes the final padded window and trims it.

Stop fighting formulas. Learn them in a day.

This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related formulas: Split text into columns · Extract first & last name · Extract text between characters

Function references: TRIM · MID · SUBSTITUTE · TEXTBEFORE