How To Separate First And Last Names In Excel

You will often receive spreadsheets with  names. Sometimes these spreadsheets have the first name and the second name within different cells in different columns. However, spreadsheets usually contain the Full name in a single column. So what do you do then? Simply follow the options mentioned below to separate the user name as first name and last name into two columns.

Separate Names through Excel's Data Menu

Level of difficulty: LOW

Excel’s Convert Text to Column

Excel’s parsing concept helps you to split and spread text from one column to multiple columns. We can parse full name into first name and last name using Excel’s text to columns wizard. Follow the steps mentioned below to understand how Text to Columns works:

Step 1: Select the column that contains the full name. Instead of selecting an entire column you can also select a range but make sure that you are not selecting text from multiple columns. Additionally, ensure that there are empty columns to the right of selected range or column. This is an important step as text on adjacent columns will be overwritten if there are no empty columns.

Step 2: On your Excel ribbon, select Data and then click the option “Text to Columns”. You will now see the Convert Text to Columns Wizard.

Step 3: The first step in this wizard is to select the data type. You have two options. First is the Delimited and the second is Fixed Width. Select Delimited if your data is separated by characters such as commas, tabs, any other special characters or symbols. Select the option Fixed width if the data in your column is separated by fixed width spaces.

How to separate first and last name in excel

Step 4: If you have chosen Delimited, then you would be able to choose the delimiters in the next screen. Available options are as follows:

1) Tab

2) Semicolon

3) Comma

4) Space

5) Other

If you select option 5 ‘Other’ it would allow you to type a character in a text box.

If you have chosen the option Fixed Width rather than Delimiter, then you would be able to set Column Breaks. To insert Columns breaks in the data preview window, click on the desired position. To delete a column break, double click on it. To move a column break, you can click and drag it to the new position.

how to separate text and numbers in excel

Step 5: The third screen would allow you to set the data type for the new column that would be populated with the data which is created at the end of this wizard. The default option is General which converts numeric values to numbers, date values to dates, and all remaining values to text. Other available options are Text and Date. You also have an option that does not import the data to a column.

how to split numbers in excel

​Step 6: Press Finish and you will be able to see the First Name and the Last Name in new columns.

Step 6

Get first name and last name using formulas

Level of difficulty: MEDIUM

Excel’s Convert Text to Column
There are no direct and specific formulas in Excel to convert the Full name into first name and last name. However, by combining multiple excel formulas we can achieve this.

To get the first nameUsing
LEFT and SEARCH formulas you can build a formula to extract the first name. Below is the syntax

Syntax :

=LEFT(CELL ADDRESS, SEARCH(“ “, CELL ADDRESS) – 1)

​Do replace the CELL ADDRESS in the above syntax with the actual value as shown in the example below:

=LEFT(B2,SEARCH(" ",B2,1)-1)

​According to this example, the full name is present in the Cell B2. When we type this formula in the Cell C2, it would generate the first name.

To get the last name
Using RIGHT, LEN, SEARCH formulas you can build a formula to extract the last name. Below is the syntax

​Syntax :

=RIGHT(CELL ADDRESS,LEN(ADDRESS) -SEARCH(" ",CELL ADDRESS))

​Do replace the CELL ADDRESS in the above syntax with the actual value as shown in the example below:

=RIGHT(B2,LEN(B2) -SEARCH(" ",B2))

According to this example, the full name is present in the Cell B2. When we type this formula in the Cell D2, it would generate the Last name.

​How does it work?

​The formula searches for space or comma in the cell’s text. If space or comma is found, all the text found on its left is extracted and displayed as the first name. The last name is displayed by extracting all text to the right of the space or comma.

Get first name and last name using macro

Level of difficulty: MEDIUM/HIGH

​Using a macro, you can create user defined functions. You can then use these functions in your Excel sheets. This will help you attain your goal using a single function. The cell containing the full name should be passed as the parameter to these user defined functions.

Function GetLastname(v_cell As Range)Dim v_firstname As StringGetLastname = VBA.Right(v_cell, VBA.Len(v_cell) - VBA.InStr(v_cell, " "))End Function

Function GetFirstname(v_cell As Range)Dim v_firstname As StringGetFirstname = VBA.Left(v_cell, VBA.InStr(v_cell, " ") - 1)
End Function

After posting these scripts into a new module, you can use these functions to separate a name as shown in the images below:

separate names in excel
split numbers in excel

To learn more about the Text Excel Formulas mentioned here as well as what I have deemed as the best Excel formulas then sign up for the free book ‘The only 27 formulas you need to succeed at work’.

    Sohail Anwar

    Click Here to Leave a Comment Below

    Leave a Comment: