Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Separating Names into Individual Columns.

Separating Names into Individual Columns

by Allen Wyatt
(last updated September 7, 2015)

3

Lance has a set of names in a workbook. The names are all in column A, and some have first and last name, while others use first, middle, and last names. He needs to separate the names into individual columns, but the Text to Columns wizard doesn't provide satisfactory results. It does the separation OK, but the two-vs.-three names issue means that Lance need to do a lot of manual massaging of the data once it is split up.

The solution to the problem is to not rely on the Text to Columns wizard, but instead use a number of formulas to get the names into columns. The results you achieve still depend, in large part, on the condition of the data you are parsing. If your data is in the format "first middle last" (with the middle name being optional), then you can use the following formula to pull out the first name:

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

This formula checks for the first space in the name, and then assumes that everything before that space is the first name. The next formula is used to determine if there is a middle name, and if there is, display it:

=IF(ISERROR(SEARCH(" ", RIGHT(A1, LEN(A1) - _
SEARCH(" ", A1, 1)), 1)) = TRUE, "", _
LEFT(RIGHT(A1,LEN(A1) - SEARCH(" ", A1, 1)), _
SEARCH(" ", RIGHT(A1, LEN(A1) - SEARCH(" ", _
A1, 1)), 1) - 1))

The formula checks for the existence of a second space in the name. If an error is generated (there is no second space) then the formula returns nothing; there is no middle name. If a second space is detected (there is no error generated), then the formula returns everything from after the first space up through the second space.

=RIGHT(A1,LEN(A1)-LEN(B1)-LEN(C1)-IF(C1="",1,2))

This formula relies on the results that were returned for both the first and middle names. It returns everything left in the original name after accounting for the length of the first name (assumed in cell B1) and the middle name (assumed in C1).

Again, these formulas work if the original data is in the "first last" or "first middle last" format. If there are qualifiers in the name such as Ms., Dr., Jr., or III, then you won't get satisfactory results. In addition, if the last name contains a space (as in "John van Kamp" or "Mary Anne St. Marie"), then you also won't get satisfactory results.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2789) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Separating Names into Individual Columns.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Searching for White Space

White space permeates our documents, and sometimes you'll need to search for that white space. Word makes it easy to select ...

Discover More

Embedding Fonts in a Document

Fonts are essential to getting your text to look just the way you want it to look. If you have a font that you use in a ...

Discover More

Using Non-Printing Notes

Adding notes to your document in Word is a handy tool. But what if you don't want those notes to be seen on the screen or ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

MORE EXCELTIPS (MENU)

Filling References to Another Workbook

When you create references to cells in other workbooks, Excel, by default, makes the references absolute. This makes it ...

Discover More

Finding the Directory Name

Need to know the directory (folder) in which a workbook was saved? You can create a formula that will return this information ...

Discover More

Returning the Smallest Non-Zero Value

In a series of values you may need to know the smallest value that isn't a zero. There is no built-in function to do this, ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments for this tip:

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 9 - 7?

2013-01-31 17:59:08

Mark Greene

Folks, I'm as far the opposite of a power user as there is or ever will be -just a lowly marketing guy trying to get a crm database loaded so I can get to work. Am confronted with a .csv file exactly as decribed in this example - some first/last, some first/MI/last, some first/MN/last, some first/last/suffix. I did the first step (entered into B1) and it worked like a charm. Where do I go from there. Tried pasting the next formula into C1, but nada.

Yes, if you rectify this for me I will buy you a steak and/or margarita next time you're in Fort Worth.

Thanks!


2012-12-22 10:46:07

Michael Avidan - MVP

If we assume that the Name string will not exceed 255 characters - then the formula will look like this:

=TRIM(MID(SUBSTITUTE($A6," ",REPT(" ",255)),255*(COLUMN()-2),255))

and copied across.

Michael Avidan
“Microsoft®” MVP – Excel
ISRAEL


2012-12-22 07:15:02

Michael Avidan - MVP

There is no need for such a "MEGA" formula.

It can be shorten by, at least, 50% as shown here:

http://ipic.se/img/1356177941.png

In addition - a very simple Split Text UDF can be used as proposed by John Walkenbach:

http://spreadsheetpage.com/index.php/tip/the_versatile_split_function/

Michael Avidan
“Microsoft®” MVP – Excel
ISRAEL


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.

Links and Sharing