Tuesday, September 18, 2018

How do I Separate First and Last Names in Excel

Best Online Excel Courses_

You will often receive spreadsheets containing usernames. Sometimes these spreadsheets have the first name and the last name in different columns. However, spreadsheets usually contain the full name in a single column. Excel classes can teach you the answer to the question of: “So, what do you do then?” Simply follow the options mentioned below to separate first and last name in Excel into two columns.

How Can You Separate First and Last Name Through The GUI?


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 in this Excel tutorial 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 a 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.

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.

Step 5: The third screen would allow you to set the data type for the new column that would be populated with the data and 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.

Step 6: Press finish and you will see the ability to see the First Name and the Last Name in new columns.

Can You Separate First and Last Name Using Formulas?


There are no direct and specific formulas to separate first and last name in Excel. However, my Excel classes can teach you the art of combining multiple Excel formulas we can achieve this.

How Can I Get the First Name in Excel?

Using left and search formulas offered to you in this online Excel course, 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 the example in this Excel training tutorial, 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 spaces or commas in the cell’s text. If a 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.

Can I Separate First and Last Name in Excel Using A Macro?

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. This is a more challenging option, so you might need additional Excel training to use this method.

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 String

GetLastname = VBA.Right(v_cell, VBA.Len(v_cell) – VBA.InStr(v_cell, ” “))

End Function

Function GetFirstname(v_cell As Range)

Dim v_firstname As String

GetFirstname = VBA.Left(v_cell, VBA.InStr(v_cell, ” “) – 1)

End Function

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

This will now have allowed you to separate first and last name in Excel.

How Excel Classes Can Make Your Use of Excel Easier

Imagine how much of a pain it would be to organize a list for the same purpose but doing so manually instead. Yeah, that would take a long time! Fortunately, my Excel classes are here to help you figure out the easiest manner of accomplishing this task.

No comments:

Post a Comment