Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Pulling Apart Cells.

Pulling Apart Cells

by Allen Wyatt
(last updated July 4, 2015)

6

It's probably happened to you before: you get data for your worksheet, and one of the columns includes names. The only problem is, the names are all bunched together. For instance, the cell contains "Allen Wyatt," but you would rather have the first name in one column, and the last name in the neighboring column to the right. How do you pull the names apart?

You can easily use the Text to Columns feature in Excel to pull your data apart. Just follow these steps:

  1. Select the range of cells you want to split.
  2. Display the Data tab of the ribbon.
  3. Click the Text to Columns tool, in the Data Tools group. Excel starts the Convert Text to Columns Wizard. (See Figure 1.)
  4. Figure 1. The beginning of the Convert Text to Columns Wizard.

  5. Choose whether the text you have selected is fixed width or delimited. (In the case of a space between first and last name, the text would be delimited.)
  6. Click on Next.
  7. Specify the delimiters you want Excel to recognize. In the case of pulling apart names, you should make sure that you use spaces as delimiters.
  8. Click on Finish.

Excel pulls apart the cells in your selected range, separating all the text at the delimiter you specified. Excel uses however many columns are necessary to hold the data.

If you don't want to spread your data completely across the columns, then you will need to use a macro. For instance, if a cell contains "John Davis, Esq.", then using the Text to Columns feature will result in the data being spread into three columns: the first containing "John", the second containing "Davis," (with the comma), and the third containing "Esq." If you would rather have the data split into two columns ("John" in one and "Davis, Esq." in the other, then the following macro will be helpful:

Sub PullApart()
    Dim Cell As Range
    Dim k As Integer

    For Each Cell In Selection
        k = InStr(Cell, " ")
        If k Then
            Cell.Offset(0, 1) = Mid(Cell, k + 1)
            Cell = Left(Cell, k - 1)
        End If
    Next
End Sub

This macro examines each cell and leaves everything up to the first space in the selected cell, and moves everything after the space into the column to the right. The only "gottcha" with this macro is to make sure you have nothing in the column to the right of whatever cells you select when you run it.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9932) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Pulling Apart Cells.

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

A Ruler in Excel

A few workarounds for the fact that Excel does not have a built-in ruler.

Discover More

Resolving Revisions

You've reviewed the changes that were made to your workbook using the Highlight Changes tool. Now you need to remove the ...

Discover More

Identifying Merged Cells

Merging cells is a common task when creating worksheets. Merged cells can play havoc with the normal functioning of some of ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

Alt+Enter Stopped Working Correctly

What do you do if a keypress you know worked correctly before all of a sudden stops working as you expect? This tip outlines ...

Discover More

Deleting Everything Up to a Character Sequence

Sometimes you have too much information in a cell and you need to "pare down" what is there to get to the info you really ...

Discover More

Displaying an Input Format in a Cell

Want to show a user, in a cell, what you expect their input to look like? Unfortuantely it cannot be done natively in Excel. ...

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

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. Maximum image size is 6Mpixels. 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 7 - 1?

2015-07-08 05:11:03

Ramon Allen

Thanks Chaps. Your ideas give me somehing to work on (as if i've notgot enough work already!!)


2015-07-08 03:34:58

Michael (Micky) Avidan

@Ramon & to whom it may concern,
I really hope nobody will hold this against me - but, to my opinion, there is a relative "simple way" to achieve Ramon's request.
I would type the an UNDERSCORE between the names which needs to stick together - such as:
Stephen Paul van_der_Nest.
After using "Text to columns" I would run a Search & replace in order to delete those Underscores.
It is not a "Brilliant" solution but it is a work-around for Ramon.
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2016)
ISRAEL


2015-07-06 08:44:14

Brian Walker

Ramon, You are SOL (that's SO Outa Luck). Our poor computers ain't that smart. The names in the middle could be part of the first name, a middle name, or the last name or some combination like your example.


2015-07-05 13:39:52

Kelly Runyon

For a mixed list (some names have two parts, some have three or more), you can write a macro that uses a dialog box to let you choose the break point when there are more than two parts. "Break at which space? (1=1st, 2=2nd, etc.)"


2015-07-04 22:42:21

Jay Jacob Wind

I'm happier with formulas than with procedures (like macros).

So to pull apart first words in text from the rest, I use

A1
Some Text

B1
=+left(a1,find(" ",a1)-1)
Some

C1
=+RIGHT(A1,LEN(A1)-LEN(B1)-1)
Text

But wait ... what if your name is like mine, with the first name "Jay Jacob" ...

Then you need to recompose.
A1
Jay Jacob Wind

B1
=+left(a1,find(" ",a1)-1)
Jay

C1
=+RIGHT(A1,LEN(A1)-LEN(B1)-1)
Jacob Wind

D1
=+left(c1,find(" ",c1)-1)
Jacob

E1
=+RIGHT(C1,LEN(C1)-LEN(D1)-1)
Wind

F1
=+B1&" "&D1
Jay Jacob

Sorry about that!


2015-07-04 06:18:23

Ramon Allen

What can I do to separate a name and surname that is of a double-barrel format e.g Stephen Paul van der Nest. I'd like Stephen | Paul | van der Nest.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu 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.