Solved

How can I split data from 1 cell into 2 cells within excel

Posted on 2004-09-03
5
1,083 Views
Last Modified: 2009-10-07
I have a leads list in MS Excel 2000, and the name field contains both LastName, FirstName. I would like to split the data in column A to (2) columns: FirstName and LastName. So Column A would be FirstName and ColumnB would be LastName.

Thanks much

--Drew
0
Comment
Question by:Drew_Mora
5 Comments
 
LVL 10

Expert Comment

by:mikeopolo
ID: 11977844
Let's say cell A1 contains
James, Mike

Then cell B1 can read:
=TRIM(RIGHT(A1,LEN(A1)-FIND(",",A1)))
and will give "Mike"
(the trim function removes the space after the comma)

Cell C1 can contain:
=LEFT(A1,FIND(",",A1)-1)
and will give "James"

Hope this helps you

Regards
James, Mike (:-)
0
 
LVL 80

Accepted Solution

by:
byundt earned 500 total points
ID: 11978008
Hi Drew_Mora,
The Data...Text to Columns menu item has the functionality you need.
1) Insert a blank column to the right of the cells containing your name field
2) Select the cells containing your name field
3) Open the Data...Text to Columns menu item
4) Choose Delimited text and click Next
5) Check the boxes for "Space", "Comma" and "Treat consecutive delimiters as one"
6) Click Finish
Cheers!

Brad
0
 
LVL 11

Expert Comment

by:huntersvcs
ID: 11979566
Hi Drew_Mora,

"byundt" has the correct answer.  You'll only run into problems if cells include Titles (Dr. Prof. etc.), middle initials, or maybe double names.  You will have to manually adjust for these entries.  If there are too many, you could run a VB script to count the empty spaces and use this as a variable to control how many columns you want to offset the split entries.

Or even easier, use a script to check if the cell to the right is empty and if not, just insert an empty cell.

Say, for example, your "Names" are in column A:

    Range("B1").Select
    x = ActiveCell.Address
    ActiveCell.Offset(0, 1).Select
    If ActiveCell.Value = "" Then
        ActiveCell.Offset(0, -1).Select
        Selection.Insert Shift:=xlToRight
    End If
    Range(x).Select

You'll have to set in either a loop or a ForEach command, but I think you get the idea.
0
 
LVL 80

Expert Comment

by:byundt
ID: 12001370
Drew,
Thanks for the grade!
Brad
0
 

Expert Comment

by:cbehnke
ID: 12401782
Something I found quite by accident ...

While I was copy / pasting number sets from emails into an Excel sheet, I was doing the manual (long and slow) method for items like:

XXXX-123456-YYYY

I would copy the first set, then paste, copy the second, paste, etc etc... I figured there had to be an easier way, so I found this tip (byundt's works wonders).

However, by accident I found that when I copied the entire string and pasted it into the row below the last entry (which I had manually broken the data across 3 columns), that it would automatically break the portions into the columns!

XXXX |_| 123456 |_| YYYY

I'm guessing there's some kind of smart filter in Excel which adapts what you've been doing to what's coming next!
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Workplace bullying has increased with the use of email and social media. Retain evidence of this with email archiving to protect your employees.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now