View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.misc
Ron Rosenfeld
 
Posts: n/a
Default How Do? Take two words in cell 1 and slpit them to cell 2 & 3

On Fri, 6 Jan 2006 10:40:16 -0600, jermsalerms
wrote:


Last Name
=REGEX.MID(A5,"\w+((,?\s)(Jr|Sr|II|III|IV|M\.?D|P H\.?D)(\.?))?$")

seems to work

I took out the string in red

=REGEX.MID(A5,"\w+((,?\s)(Jr|Sr|II|III|IV|M\.?D|( ? i)PH\.?D)(\.?))?$")


I don't know what's in red, as my newsreader does not reproduce that.

OK I went to the site where you posted originally and I see what has happened.
For some reason, and it is not in my newsreader, your site added an extraneous
space.

This fragment: M\.?D|(? i)PH\.?D)

There should NOT be a space between the '?' and the 'i'

The fragment should read:

M\.?D|(?i)PH\.?D)

I don't understand why that space is there as it was not sent out from here
that way. Nor does it appear to be a word wrap issue.

The (?i) parameter allows case-insensitive matching of PHD so that Ph.D., PH.D.
PHD PhD should all match.

On my original, if you remove that space, it should work fine.

--ron