The guide · LEFT, MID + FIND
Find the space
=FIND(" ", A2) returns the position of the first space. In "Ada Lovelace" that's 4: A, d, a, then the space. Everything before it is the first name, everything after it the last name.
First name: LEFT
LEFT(text, n) takes the first n characters. The first name is one character shorter than the position of the space, so: =LEFT(A2, FIND(" ", A2) - 1). Without the -1 you get "Ada " with a space at the end. It looks the same, but lookups and comparisons treat it as different text.
Last name: MID or RIGHT
MID(text, start, n) takes n characters from a starting position. Start one after the space and take plenty: =MID(A2, FIND(" ", A2) + 1, LEN(A2)). Asking for more characters than are left is fine. The RIGHT version counts from the end, so it needs the exact length: =RIGHT(A2, LEN(A2) - FIND(" ", A2)).
In Excel 365: TEXTBEFORE and TEXTAFTER
=TEXTBEFORE(A2, " ") and =TEXTAFTER(A2, " ") do the same in one step. They're easier to read, but files opened in Excel 2021 or older show #NAME?.
No formula: Text to Columns and Flash Fill
Data → Text to Columns splits on the space once, and Flash Fill (Ctrl+E) copies a pattern you type. Both are quick for a one-off clean-up, but the results are fixed values: add a new name and you have to do it again. A formula updates by itself.
Common mistakes
- Forgetting -1. The first name ends with a space.
- Forgetting +1. The last name starts with a space.
- A fixed length, like LEFT(A2, 3). Right for Ada, wrong for Alan. Let FIND measure each name.
- Middle names. This formula puts "King Lovelace" in the last-name column for "Ada King Lovelace". To take only the last word in Excel 365, use
=TEXTAFTER(A2, " ", -1).
FAQ
- How do I separate first and last names in Excel?
- Use =LEFT(A2,FIND(" ",A2)-1) for the first name and =MID(A2,FIND(" ",A2)+1,LEN(A2)) for the last name, then fill both down.
- Why is there a space at the end of my first name?
- FIND returns the position of the space itself, so LEFT(A2,FIND(" ",A2)) includes it. Subtract 1: LEFT(A2,FIND(" ",A2)-1).
- How do I get the last name when there is a middle name?
- In Excel 365, =TEXTAFTER(A2," ",-1) returns the text after the last space. In older versions this needs a longer formula with SUBSTITUTE.
- Should I use Text to Columns or a formula to split names?
- Text to Columns is quick for a one-time clean-up. Use a formula when the list will change, because it updates automatically.