Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
jermsalerms
 
Posts: n/a
Default How Do? Take two words in cell 1 and slpit them to cell 2 & 3


I want to take a clients 1st and last name that populates in cell 1 and
break it apart so that cell 2 only shows the last name and cell 3 shows
only the first name.

How do I write a formula to fill in the 1st word vs the 2nd word in
cell 1...also some have a middle initial that I do not want to be
included in either but some do not so I need it to recognize the
difference.


--
jermsalerms
------------------------------------------------------------------------
jermsalerms's Profile: http://www.excelforum.com/member.php...o&userid=30167
View this thread: http://www.excelforum.com/showthread...hreadid=498521

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

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

and

C1: =RIGHT(A1,LEN(A1)-FIND(" ",A1))

or maybe

C1: =SUBSTITUTE(A1,B1&" ","")

--

HTH

RP
(remove nothere from the email address if mailing direct)


"jermsalerms"
wrote in message
...

I want to take a clients 1st and last name that populates in cell 1 and
break it apart so that cell 2 only shows the last name and cell 3 shows
only the first name.

How do I write a formula to fill in the 1st word vs the 2nd word in
cell 1...also some have a middle initial that I do not want to be
included in either but some do not so I need it to recognize the
difference.


--
jermsalerms
------------------------------------------------------------------------
jermsalerms's Profile:

http://www.excelforum.com/member.php...o&userid=30167
View this thread: http://www.excelforum.com/showthread...hreadid=498521



  #3   Report Post  
Posted to microsoft.public.excel.misc
Johnny - Accountant at Large
 
Posts: n/a
Default How Do? Take two words in cell 1 and slpit them to cell 2 & 3

This is the simple solution:
Column 1 = Full Name
Column 2 = LEFT(Column1,FIND(" ",Column1,1))
Column 3 = =RIGHT(Column1,LEN(Column1)-LEN(Column2))

Basically the formula for col 2 says take anything in column 1 until you hit
the first space and then for col 3 take col 1 and remove a certain number of
characters from the left side equal to the legnth of col 2.

You can run into problems if you have multiple spaces, like someone has a
midlle initial, but I hope it helps.

"jermsalerms" wrote:


I want to take a clients 1st and last name that populates in cell 1 and
break it apart so that cell 2 only shows the last name and cell 3 shows
only the first name.

How do I write a formula to fill in the 1st word vs the 2nd word in
cell 1...also some have a middle initial that I do not want to be
included in either but some do not so I need it to recognize the
difference.


--
jermsalerms
------------------------------------------------------------------------
jermsalerms's Profile: http://www.excelforum.com/member.php...o&userid=30167
View this thread: http://www.excelforum.com/showthread...hreadid=498521


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

To extract the First Name:

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

To extract the Last Name:

=MID(A1,FIND("~",SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))))+1,255)

HTH,
Elkar


"jermsalerms" wrote:


I want to take a clients 1st and last name that populates in cell 1 and
break it apart so that cell 2 only shows the last name and cell 3 shows
only the first name.

How do I write a formula to fill in the 1st word vs the 2nd word in
cell 1...also some have a middle initial that I do not want to be
included in either but some do not so I need it to recognize the
difference.


--
jermsalerms
------------------------------------------------------------------------
jermsalerms's Profile: http://www.excelforum.com/member.php...o&userid=30167
View this thread: http://www.excelforum.com/showthread...hreadid=498521


  #5   Report Post  
Posted to microsoft.public.excel.misc
Roger Govier
 
Posts: n/a
Default How Do? Take two words in cell 1 and slpit them to cell 2 & 3

Hi

Try
In B1
=LEFT(A1,FIND(" ",A1)-1)
In C1
=IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))=2,
MID(A1,FIND(" ",SUBSTITUTE(A1," ","*",1))+1,255),
MID(A1,FIND(" ",A1)+1,255))

--
Regards

Roger Govier


"jermsalerms"
wrote in message
...

I want to take a clients 1st and last name that populates in cell 1
and
break it apart so that cell 2 only shows the last name and cell 3
shows
only the first name.

How do I write a formula to fill in the 1st word vs the 2nd word in
cell 1...also some have a middle initial that I do not want to be
included in either but some do not so I need it to recognize the
difference.


--
jermsalerms
------------------------------------------------------------------------
jermsalerms's Profile:
http://www.excelforum.com/member.php...o&userid=30167
View this thread:
http://www.excelforum.com/showthread...hreadid=498521





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


Your formula works great but I found that some of my contacts have Jr,
Sr., etc.

With your formula what I get for the last name is just Jr.

What would make it reflect say "Smith Jr." for example


Thanks


--
jermsalerms
------------------------------------------------------------------------
jermsalerms's Profile: http://www.excelforum.com/member.php...o&userid=30167
View this thread: http://www.excelforum.com/showthread...hreadid=498521

  #7   Report Post  
Posted to microsoft.public.excel.misc
Roger Govier
 
Posts: n/a
Default How Do? Take two words in cell 1 and slpit them to cell 2 & 3

Hi

Life is never easy is it?
What I would do, is first do a Search & Replace.
Ctrl+H Find Jr. (that is a space followed
by Jr.)
Replace _Jr. (underscore followed by
Jr.)
Replace All

Repeat for Sr.

Use my formula to do your split.
Then reverse the Find & Replace to change the underscore back to a
space.


--
Regards

Roger Govier


"jermsalerms"
wrote in message
...

Your formula works great but I found that some of my contacts have Jr,
Sr., etc.

With your formula what I get for the last name is just Jr.

What would make it reflect say "Smith Jr." for example


Thanks


--
jermsalerms
------------------------------------------------------------------------
jermsalerms's Profile:
http://www.excelforum.com/member.php...o&userid=30167
View this thread:
http://www.excelforum.com/showthread...hreadid=498521



  #8   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 Thu, 5 Jan 2006 16:51:30 -0600, jermsalerms
wrote:


I want to take a clients 1st and last name that populates in cell 1 and
break it apart so that cell 2 only shows the last name and cell 3 shows
only the first name.

How do I write a formula to fill in the 1st word vs the 2nd word in
cell 1...also some have a middle initial that I do not want to be
included in either but some do not so I need it to recognize the
difference.


You could use regular expressions to handle all sorts of variations.

First, download and install Longre's free morefunc.xll add-in from
http://xcell05.free.fr/

Then for example, given:

John Doe
Ms John Doe
John J Doe
Mr. John Doe, Jr
Dr John J Doe, Jr
John Doe MD
John Doe Ph.D.



First Name:

=REGEX.MID(A1,"(?!D|M(\w{0,2}))(?<=\s|^)\w+\s")

Last Name including the Title

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

=================================

Rules:

Any first word will be omitted that either ends with a dot (.) or, if it starts
with an M or a D, and is followed by 0 to 2 letters (eg. Mrs. Ms Ms. M M. Dr
Dr. should all be excluded).

This, purposely will also exclude leading initials:

J. John Doe will also -- John for a first name. (This could be changed).

Various titles are delineated specifically, as I could not think of a general
rule that would include them all.


--ron
  #9   Report Post  
Posted to microsoft.public.excel.misc
jermsalerms
 
Posts: n/a
Default How Do? Take two words in cell 1 and slpit them to cell 2 & 3


The expression works for the first name but returns as #VALUE on the
last name. I am not familiar with expressions. Any idea what is causing
this?


--
jermsalerms
------------------------------------------------------------------------
jermsalerms's Profile: http://www.excelforum.com/member.php...o&userid=30167
View this thread: http://www.excelforum.com/showthread...hreadid=498521

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


Last Name
=REGEX.MID(A5,"\w+((,?\s)(Jr|Sr|II|III|IV|M\.?D|PH \.?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)(\.?))?$")


--
jermsalerms
------------------------------------------------------------------------
jermsalerms's Profile: http://www.excelforum.com/member.php...o&userid=30167
View this thread: http://www.excelforum.com/showthread...hreadid=498521



  #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
  #12   Report Post  
Posted to microsoft.public.excel.misc
jermsalerms
 
Posts: n/a
Default How Do? Take two words in cell 1 and slpit them to cell 2 & 3


Ron,

I found that when a persons name starts with M it skips the first name
and inputs the middle initial

for example

MICHEAL B SMITH

returns

B

How would this be corrected?


--
jermsalerms
------------------------------------------------------------------------
jermsalerms's Profile: http://www.excelforum.com/member.php...o&userid=30167
View this thread: http://www.excelforum.com/showthread...hreadid=498521

  #13   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 12:06:03 -0600, jermsalerms
wrote:


Ron,

I found that when a persons name starts with M it skips the first name
and inputs the middle initial

for example

MICHEAL B SMITH

returns

B

How would this be corrected?


This should do it, and will also remove the space following the FN.

=REGEX.MID(A1,"(?!D|M(\w{0,2}(\.\s|\s)))(?<=\s|^)\ w+(?=\s)")

Did you also see my note about the Last Name issue?


--ron
  #14   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 12:06:03 -0600, jermsalerms
wrote:


Ron,

I found that when a persons name starts with M it skips the first name
and inputs the middle initial

for example

MICHEAL B SMITH

returns

B

How would this be corrected?


Ignore my last. Use this instead:

=REGEX.MID(A1,"(?!(D|M)(\w{0,2}(\.\s|\s)))(?<=\s|^ )\w+(?=\s)")


--ron
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



All times are GMT +1. The time now is 12:51 AM.

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"