[Solved] Split data into two columns? How to?

Discuss the spreadsheet application
Post Reply
dax702
Posts: 73
Joined: Tue May 13, 2008 3:55 am

[Solved] Split data into two columns? How to?

Post by dax702 »

I have a column of data like is seen below.

Joe Blow, Los Angeles, CA
Jane Doe, The Netherlands
John Jeff Spaniard, Madrid, Spain
Joe Downunder, Perth, W. Australia
Asian Guy, Jakarta, Indonesia

What I need to do is split the column into two columns, after the first comma (and ignore the second comma). See below (I'm using the | to designate a column) so that the name of the person is in one column and their location is in another column. How to accomplish this in Calc?

Joe Blow | Los Angeles, CA
Jane Doe | The Netherlands
John Jeff Spaniard | Madrid, Spain
Joe Downunder | Perth, W. Australia
Asian Guy | Jakarta, Indonesia

Thanks in advance!
Last edited by dax702 on Tue Nov 24, 2009 4:52 am, edited 1 time in total.
ken johnson
Volunteer
Posts: 918
Joined: Sun May 31, 2009 1:35 am
Location: Sydney, Australia

Re: Split data into two columns? How to?

Post by ken johnson »

If Joe Blow, Los Angeles, CA is in A2 then...
=LEFT(A2;FIND(",";A2)-1) returns Joe Blow
=MID(A2;FIND(",";A2)+2;255) returns Los Angeles, CA

Ken Johnson
AOO 4.1.3 on Ms Windows 10
Help improve this forum by clicking the EDIT button on your first post then adding "[Solved]" to its heading once a solution to your problem has been provided.
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Split data into two columns? How to?

Post by acknak »

KJ's formulas should work fine; here's another approach...

You can't use Calc's Data > Text to Columns feature because it will divide the data at every comma. But, you can change the first comma to some other character, then split on that.

Edit > Find & Replace
Search for: ^([^,]+), *(.*)
Replace with: $1!$2
Options: Regular expressions: YES
Click "Replace All"

Then, use Data > Text to Columns; Separated by > Other: !
AOO4/LO5 • Linux • Fedora 23
dax702
Posts: 73
Joined: Tue May 13, 2008 3:55 am

Re: Split data into two columns? How to?

Post by dax702 »

Thank you so much, works perfectly!!
OpenOffice.org 3.2.1 with Windows 7
vishala
Posts: 1
Joined: Thu Jun 24, 2010 1:59 pm

Re: [Solved] Split data into two columns? How to?

Post by vishala »

hello friends...
I have a file of 300 pages written by givng spaces to look like 2 columns. now i need to select the contents of a single column for all the pages at a time...How is this possible....

waiting for the reply.....
Thank you....
openoffice3.1/linux
ken johnson
Volunteer
Posts: 918
Joined: Sun May 31, 2009 1:35 am
Location: Sydney, Australia

Re: [Solved] Split data into two columns? How to?

Post by ken johnson »

For each of those columns you will first need to insert a column to its right side then use Data|Text to Columns with Separator options being Separated by Space and Merge delimiters.

Ken Johnson
AOO 4.1.3 on Ms Windows 10
Help improve this forum by clicking the EDIT button on your first post then adding "[Solved]" to its heading once a solution to your problem has been provided.
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Solved] Split data into two columns? How to?

Post by acknak »

Hold on, are we talking about a spreadsheet document or a text document?
AOO4/LO5 • Linux • Fedora 23
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Solved] Split data into two columns? How to?

Post by acknak »

Yes, but someone has inserted a new question: http://user.services.openoffice.org/en/ ... 01#p145401 and I can't tell if it's really a continuation of the Calc topic or a new topic that should be split off.
AOO4/LO5 • Linux • Fedora 23
Post Reply