Page 1 of 1

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

Posted: Mon Nov 23, 2009 9:28 am
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!

Re: Split data into two columns? How to?

Posted: Mon Nov 23, 2009 2:23 pm
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

Re: Split data into two columns? How to?

Posted: Mon Nov 23, 2009 2:35 pm
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: !

Re: Split data into two columns? How to?

Posted: Tue Nov 24, 2009 4:52 am
by dax702
Thank you so much, works perfectly!!

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

Posted: Thu Jun 24, 2010 2:05 pm
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....

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

Posted: Thu Jun 24, 2010 3:35 pm
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

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

Posted: Thu Jun 24, 2010 6:38 pm
by acknak
Hold on, are we talking about a spreadsheet document or a text document?

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

Posted: Thu Jun 24, 2010 7:27 pm
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.