Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Lee Harris
 
Posts: n/a
Default Text Splitting easier? (Tokeniser?)

I've a column of text, generally in the form

Surname, Forename


I want to split into two columns automatically with Forename and Surname
separately. I've been able to do it with MID and FIND, but it's quite clunky
and wondered if there was a quicker, easier or more elegant way just to
tokenise a string based on a defined separator (in this case the character ,
followed by a space)

tks in advance


  #2   Report Post  
Biff
 
Posts: n/a
Default Text Splitting easier? (Tokeniser?)

Hi!

Don't know what your formulas look like but these will do the job:

Forename:

=MID(A1,FIND(", ",A1)+2,255)

Surname:

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

Both, far from clunky!

You could use DataText to Columns but it's not automatic.

Biff

"Lee Harris" wrote in message
...
I've a column of text, generally in the form

Surname, Forename


I want to split into two columns automatically with Forename and Surname
separately. I've been able to do it with MID and FIND, but it's quite
clunky and wondered if there was a quicker, easier or more elegant way
just to tokenise a string based on a defined separator (in this case the
character , followed by a space)

tks in advance



  #3   Report Post  
Anne Troy
 
Posts: n/a
Default Text Splitting easier? (Tokeniser?)

Try selecting your column, and use Data--Text to columns.
http://www.officearticles.com/excel/...soft_excel.htm
(About halfway down the page)
************
Anne Troy
www.OfficeArticles.com

"Lee Harris" wrote in message
...
I've a column of text, generally in the form

Surname, Forename


I want to split into two columns automatically with Forename and Surname
separately. I've been able to do it with MID and FIND, but it's quite
clunky and wondered if there was a quicker, easier or more elegant way
just to tokenise a string based on a defined separator (in this case the
character , followed by a space)

tks in advance



  #4   Report Post  
Jim
 
Posts: n/a
Default Text Splitting easier? (Tokeniser?)

On the Data menu, click Text to Columns, select the radio button marked
"Delimited" select "Next" and then select the "Comma" check box. Hit finish

"Lee Harris" wrote:

I've a column of text, generally in the form

Surname, Forename


I want to split into two columns automatically with Forename and Surname
separately. I've been able to do it with MID and FIND, but it's quite clunky
and wondered if there was a quicker, easier or more elegant way just to
tokenise a string based on a defined separator (in this case the character ,
followed by a space)

tks in advance



  #5   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default Text Splitting easier? (Tokeniser?)

On Fri, 21 Oct 2005 21:45:01 GMT, "Lee Harris" wrote:

I've a column of text, generally in the form

Surname, Forename


I want to split into two columns automatically with Forename and Surname
separately. I've been able to do it with MID and FIND, but it's quite clunky
and wondered if there was a quicker, easier or more elegant way just to
tokenise a string based on a defined separator (in this case the character ,
followed by a space)

tks in advance


I don't know if it's more elegant to use regular expressions.

Laurent Longre has written a free add-in which allows the use of regular
expressions. You can download morefunc.xll from http://xcell05.free.fr/

The formulas to extract the 1st and 2nd word would then be, simply:

=REGEX.MID($A1,"\w*",1)
=REGEX.MID($A1,"\w*",2)


--ron


  #6   Report Post  
Lee Harris
 
Posts: n/a
Default Text Splitting easier? (Tokeniser?)


"Biff" wrote in message
...
Hi!

Don't know what your formulas look like but these will do the job:

Forename:

=MID(A1,FIND(", ",A1)+2,255)

Surname:

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

Both, far from clunky!

You could use DataText to Columns but it's not automatic.

Biff


Thanks, that is the formula I used more or less, but thought it was a bit
clunky. Since you can split data into columns via the menu, I thought there
would be an equivalent function like SPLIT or TOKENISE or something
not to worry, thanks for the help


  #7   Report Post  
Difficult1
 
Posts: n/a
Default Text Splitting easier? (Tokeniser?)

Lee,

Insert a column after your combined info (Surname and Forename), highlight
the column you want split out (ie if Surname and Forename are in Column "A",
highlight "A") then go to the "Data" menu and "Text to Columns". If your
data is consistant (ie John Smith and none without a Middle Initial) I would
suggest using the delimated by character, the character being the space. The
wizard will walk you through the rest.

Difficult1

"Lee Harris" wrote:

I've a column of text, generally in the form

Surname, Forename


I want to split into two columns automatically with Forename and Surname
separately. I've been able to do it with MID and FIND, but it's quite clunky
and wondered if there was a quicker, easier or more elegant way just to
tokenise a string based on a defined separator (in this case the character ,
followed by a space)

tks in advance



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Resizing row height to dynamically fit height of text box Jon Excel Discussion (Misc queries) 1 August 8th 05 01:37 PM
Text Wrapping JMB Excel Discussion (Misc queries) 0 July 29th 05 02:41 AM
Finding Specific Text in a Text String Peter Gundrum Excel Worksheet Functions 9 April 10th 05 07:21 PM
SUMPRODUCT vs Text??? Ken Excel Worksheet Functions 2 April 9th 05 07:21 PM
Autofitting a row Josephine Excel Discussion (Misc queries) 2 March 3rd 05 03:37 PM


All times are GMT +1. The time now is 12:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"