FormulaCraft

How to get the last word in a cell in Excel and Google Sheets

Topic:Text manipulation
Excel & Google Sheets
=TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",100)),100))

Verified example

Computed by a real spreadsheet engine on the sample data below.

Phrase
Hello world
One two three
Quick brown fox
Spreadsheet formulas

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

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1SUBSTITUTE(A2," ",REPT(" ",100)) replaces every space with 100 spaces, ensuring the last word occupies the final 100 characters.
  2. 2RIGHT(...,100) takes the last 100 characters of that expanded string.
  3. 3TRIM() removes all leading and trailing spaces, leaving only the last word.
  4. 4The combined formula is: =TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",100)),100)).
  5. 5If you need a pure-formula version based on LEN and FIND: =RIGHT(TRIM(A2),LEN(TRIM(A2))-FIND("*",SUBSTITUTE(TRIM(A2)," ","*",LEN(TRIM(A2))-LEN(SUBSTITUTE(TRIM(A2)," ",""))))).

Tips

Need it for your exact data?

Describe your columns in plain English and get the precise formula for your sheet, with the right Excel or Sheets syntax.

Frequently asked

What if the cell has only one word?

The formula returns the entire cell value, which is correct — a single word is also the last word.

What if there are trailing spaces?

Wrap A2 in TRIM() before applying SUBSTITUTE to remove trailing spaces first: =TRIM(RIGHT(SUBSTITUTE(TRIM(A2)," ",REPT(" ",100)),100)).

More on Text manipulation

See all →

Formulas used

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: