View Single Post
  #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