View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Pull Out Last Name

On Thu, 24 Aug 2006 18:17:01 -0700, WDP wrote:

Hi:

I am looking for a function in Excel to extract the LAST NAME from a cell
that looks like:

Justin Kenney

I want the formula to give me only the last name (ie Kenney)

Can anyone help with a formual (maybe the RIGHT function) that looks RIGHT
TO LEFT for the 1st space...and then gives me everything to the RIGHT of the
space

Thanks
Warren


This formula will pull out everything after the last space in the string:

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

If there might be a trailing <space in the string, then use:

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


--ron