Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 111
Default splitting contents of a cell

i have many (over 8000) cells with names and i want to isolate the last name.
the problem is that the format varies. Possible formats

1. A. Sharp
2. Allison Sharp
3. Dr. Allison Sharp
4. Dr and Mr Allison sharp
5. Capt. Allison Sharp, USN, Ret

i could give more examples, but i think that you get the idea. i have tried
text to columns but because there is not pattern this isn't very efficient.

thanks in advance for your help

--
aprilshowers
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,276
Default splitting contents of a cell

Hi,

=TRIM(RIGHT(A1,FIND(" ",A1)+2))

if this helps please click yes thanks

"april" wrote:

i have many (over 8000) cells with names and i want to isolate the last name.
the problem is that the format varies. Possible formats

1. A. Sharp
2. Allison Sharp
3. Dr. Allison Sharp
4. Dr and Mr Allison sharp
5. Capt. Allison Sharp, USN, Ret

i could give more examples, but i think that you get the idea. i have tried
text to columns but because there is not pattern this isn't very efficient.

thanks in advance for your help

--
aprilshowers

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,856
Default splitting contents of a cell

Here's one way that Biff posted about a year ago:

=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",255)),255))

with your text in A1.

Hope this helps.

Pete

On Dec 21, 5:21*pm, april wrote:
i have many (over 8000) cells with names and i want to isolate the last name.
*the problem is that the format varies. *Possible formats

1. *A. Sharp
2. *Allison Sharp
3. *Dr. Allison Sharp
4. *Dr and Mr Allison sharp
5. *Capt. Allison Sharp, USN, Ret

i could give more examples, but i think that you get the idea. *i have tried
text to columns but because there is not pattern this isn't very efficient.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default splitting contents of a cell

Try the below in cell B1 with data in cell A1 and copy down as required. The
below formula would split the cells with comma to pick the first element and
then extract the last word.

=TRIM(RIGHT(SUBSTITUTE(IF(ISNUMBER(FIND(",",A1)),
REPLACE(A1,FIND(",",A1),99,""),A1)," ",REPT(" ",255)),255))

--
Jacob


"april" wrote:

i have many (over 8000) cells with names and i want to isolate the last name.
the problem is that the format varies. Possible formats

1. A. Sharp
2. Allison Sharp
3. Dr. Allison Sharp
4. Dr and Mr Allison sharp
5. Capt. Allison Sharp, USN, Ret

i could give more examples, but i think that you get the idea. i have tried
text to columns but because there is not pattern this isn't very efficient.

thanks in advance for your help

--
aprilshowers

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default splitting contents of a cell

On Mon, 21 Dec 2009 09:21:01 -0800, april
wrote:

i have many (over 8000) cells with names and i want to isolate the last name.
the problem is that the format varies. Possible formats

1. A. Sharp
2. Allison Sharp
3. Dr. Allison Sharp
4. Dr and Mr Allison sharp
5. Capt. Allison Sharp, USN, Ret

i could give more examples, but i think that you get the idea. i have tried
text to columns but because there is not pattern this isn't very efficient.

thanks in advance for your help


From what you post, it appears that the last name is either the last word in
the string, or it is the first word that is followed by a comma.

That being the case:

=TRIM(RIGHT(SUBSTITUTE(LEFT(TRIM(A1)&",",
FIND(",",TRIM(A1)&",")-1)," ",REPT(" ",99)),99))

--ron


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 111
Default splitting contents of a cell

Unfortunately none of these solutions work. Jacob and Pete, your formulas
give me the last character of the string. for instance, if the string was
Dr. Tom Feelgood M.D., your formulas returned "."

Ron, i was mistaken in my examples. there is no "," in the string. i
believe that i gave an example of Capt. John Smith, USN, Ret. Instead the
string reads Capt. John Smith USN (ret).

thanks for the help though. any more ideas?

thanks in advance
--
aprilshowers


"Eduardo" wrote:

Hi,

=TRIM(RIGHT(A1,FIND(" ",A1)+2))

if this helps please click yes thanks

"april" wrote:

i have many (over 8000) cells with names and i want to isolate the last name.
the problem is that the format varies. Possible formats

1. A. Sharp
2. Allison Sharp
3. Dr. Allison Sharp
4. Dr and Mr Allison sharp
5. Capt. Allison Sharp, USN, Ret

i could give more examples, but i think that you get the idea. i have tried
text to columns but because there is not pattern this isn't very efficient.

thanks in advance for your help

--
aprilshowers

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
splitting out cell contents ksh Excel Discussion (Misc queries) 2 January 14th 08 06:14 PM
Splitting cell contents GARY Excel Discussion (Misc queries) 3 November 5th 07 11:53 PM
Splitting cell contents GARY Excel Discussion (Misc queries) 1 November 5th 07 06:58 PM
Splitting the contents of a cell Keith Excel Discussion (Misc queries) 7 September 21st 06 07:21 PM
Splitting the contents of a cell? Dan B Excel Worksheet Functions 4 December 8th 05 08:34 PM


All times are GMT +1. The time now is 09:51 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"