Splitting Maria Lopez into a first and last name is a daily chore for mailing lists and imports. In Excel 365 TEXTBEFORE and TEXTAFTER make it trivial; in older versions LEFT/RIGHT with FIND get it done.
The example
Full names split into first and last.
| A | B | C | |
|---|---|---|---|
| 1 | Full name | First | Last |
| 2 | Maria Lopez | Maria | Lopez |
| 3 | Devon Smith | Devon | Smith |
| 4 | Priya Patel | Priya | Patel |
The formula
First name in B2, last name in C2:
How it works
Each function works from the space that separates the two names:
TEXTBEFORE(A2, " ")returns everything to the left of the first space — the first name.TEXTAFTER(A2, " ")returns everything to the right of the first space — the last name.- For names with a middle name,
TEXTAFTER(A2, " ", -1)takes the text after the last space to isolate the surname.
Even faster for a whole column: Flash Fill. Type the first name once next to the data and press Ctrl+E; Excel fills the rest by pattern. Great for one-offs, but it doesn’t update if the source changes — formulas do.
Try it: interactive demo
Type a full name; see the first and last name each formula returns.
Variations
Legacy first name (LEFT + FIND)
Any version — characters up to the first space:
Legacy last name (RIGHT + LEN + FIND)
Everything after the first space:
Handle a middle name
Take the surname as the text after the final space:
Pitfalls & errors
#N/A or #VALUE! on single-word entries. A cell with no space has nothing to split. Guard it: =IFERROR(TEXTAFTER(A2," "), "").
Extra spaces break the split. Double spaces or leading spaces from pasted data shift the result. Wrap the name in TRIM(A2) first.
TEXTBEFORE/TEXTAFTER need Excel 365. Older versions show #NAME? — use the LEFT/RIGHT/FIND formulas.
Practice workbook
Frequently asked questions
How do I separate first and last names in Excel?
How do I handle middle names?
Should I use Flash Fill instead?
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