In this step by step tutorial, we are going take a look at how to split first and last name in excel with detailed examples.
Data mining is a cumbersome work!
You need to have a better understanding of various excel text formulas and tools like the Text to Columns to deal with the situation.
If you happen to be the one who lacks these skills, then no worries, you’ll certainly have a better understanding after reading this tutorial.
Guide to Split First and Last Name in Excel
Let me start with a simple example where you just need to separate employee first name in one column & second name in the other column.
This is how our data will look like.
For this example, we will use built-in Text to Columns option to separate names.
Step 1: Select A2:A10 → head over to Data → Click on Text to Columns
Step 2: Select Delimited & click next
Step 3: Under Delimiter section → enable ‘Space’ checkbox
Step 4: Click on next → click on Finish
Pro Tip: In case if you don’t have space in your data, you can enable Other Delimiter and specify accordingly.
Excel separate first and last name using formulas [Right & Left]
There is no doubt, Text to columns is a great tool to separate names in excel, but it has a drawback.
The drawback is, it’s not a live tool.
Suppose, if your data is constantly changing then you will have to do same steps again and again.
The good thing is you can automate using excel text formulas.
1) Separate first name using Left formula
In simple terms, Left is a formula to extract user specified letters from the left side of the text.
For example, to extract ‘Timothy’ from ‘Timothy Fox’ you can write a formula like below:
which means, we are instructing excel to extract first 7 letters from cell A2 (Timothy Fox). Awesome!
Hang on, there is a problem here.
Since we just have one name we were able to count the total number of letters to extract.
what if you have thousands of names in your workbook?
Can you count? The answer is no!
So, we have a workaround for that.
We will use FIND() formula to identify the number of letters to extract.
How to use FIND formula to count number of letters to extract
Insert FIND formula in first name section
Specify ‘Find Text’ (for this example, we will use blank space)
Provide ‘within text’ range. Now you’ll see find formula will return blank space position
Now that we know how many letters to extract, let’s add left formula to separate the first name.
Add left formula before Find like this =LEFT(A2,FIND(” “,A2))
2) Separate last name using Right formula
The other part of this tutorial is to split the last name using Right formula.
The functionality of Right formula is similar to Left but the only change is it will extract text from the right side of the text.
For this, we need to use three formulas.
- Find → to find blank space
- Len → to find total letters (including space)
- Right → to split the last name
Find: please follow same steps as explained above
= FIND(” “,A2)
Len: Insert LEN formula to count total letters in your text (it will be including any blank spaces/ special characters).
Now subtract Total letters i.e. LEN – FIND (letters till blank space).
After the third step, you will have to exact the last name from right side → add Right formula like below
Wow finally !!
We know how to split first and last name in excel using formulas. Great !
How to separate middle name in excel using formulas:
I’ve seen few comments asking how to split middle name using formulas. So here is a tutorial for that.
For example, if we have a name like “Mark Anthony Fernandez” then how will you split?
In this example, we have three names (first, middle & last name), by now you know how to extract first & the last name using Right & Left formulas. So, the only issue is extracting middle name.
We’ll use Substitute formula like below to add multiple spaces (for this example I’m adding 50 blank spaces after Anthony).
=SUBSTITUTE(A1,” “,REPT(” “,50),2)
Now, we’ll use MID formula to extract middle name like below .
=MID(SUBSTITUTE(A1,” “,REPT(” “,50),2),FIND(” “,A1),50)
Let’s add TRIM formula to remove unwanted spaces.
=TRIM(MID(SUBSTITUTE(A1,” “,REPT(” “,50),2),FIND(” “,A1),50))
After all the steps your result will look like this.
In case if you have a better way to extract middle name using formulas please let me know.
As promised, by now you know how to split first and last name in excel using various methods. For ad-hoc reporting, I’d suggest using text to columns functionality.
In case if you are building financial models then it’s a good idea to use above explained formulas to separate names in excel.