The last name is the text after the last space. In Microsoft 365: =TEXTAFTER(A2, " ", -1), where -1 means the last space. In older Excel, a classic trick replaces the last space with a marker and takes everything after it.
{"cells": {"A1": "Full name", "A2": "Anna Petrova", "A3": "Ivan Georgiev", "A4": "Maria Ivanova Dimitrova", "A5": "Elena Stoyanova", "B1": "Last name", "B2": "=TEXTAFTER(A2,\" \",-1)", "B3": "=TEXTAFTER(A3,\" \",-1)", "B4": "=TEXTAFTER(A4,\" \",-1)", "B5": "=TEXTAFTER(A5,\" \",-1)", "C1": "Older Excel", "C2": "=TRIM(RIGHT(SUBSTITUTE(A2,\" \",REPT(\" \",100)),100))", "C3": "=TRIM(RIGHT(SUBSTITUTE(A3,\" \",REPT(\" \",100)),100))", "C4": "=TRIM(RIGHT(SUBSTITUTE(A4,\" \",REPT(\" \",100)),100))", "C5": "=TRIM(RIGHT(SUBSTITUTE(A5,\" \",REPT(\" \",100)),100))"}, "focus": "B4", "note": "Row 4 has a middle name: both formulas still return the last word."}
TEXTAFTER (Microsoft 365)
The -1 counts from the end, so it works with middle names too.
=TEXTAFTER(A2, " ", -1)Petrova from "Anna Petrova", Dimitrova from "Maria Ivanova Dimitrova".Older Excel: SUBSTITUTE and RIGHT
Replace every space with 100 spaces, take the last 100 characters, and TRIM the padding away.
=TRIM(RIGHT(SUBSTITUTE(A2, " ", REPT(" ", 100)), 100))The last word in any version.Only two names
When every name has exactly one space, RIGHT with LEN and FIND is enough.
=RIGHT(A2, LEN(A2)-FIND(" ", A2))Everything after the first space.Common mistakes
- Middle names end up in the result
RIGHT(A2, LEN(A2)-FIND(" ", A2))uses the first space. Use one of the last-space formulas.- Trailing spaces
- A space at the end of the cell makes the last word empty. Use TRIM(A2) inside the formula.
Frequently asked questions
How do I get the first name?
How do I split a full name into two columns?
Data → Text to Columns → Delimited → Space, or in Microsoft 365 =TEXTSPLIT(A2, " "). See split text by a delimiter.
Does this work for "Surname, First" names?
Then the surname is before the comma: =TEXTBEFORE(A2, ",").