View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.newusers
Ron de Bruin
 
Posts: n/a
Default Extracting First Name

Try this for the first word

=IF(ISERR(FIND(" ",A2)),A2,IF(RIGHT(LEFT(A2,FIND(" ",A2)-1))=",",LEFT(A2,FIND(" ",A2)-2),LEFT(A2,FIND(" ",A2)-1)))


Last word
=IF(ISERR(FIND(" ",A2)),A2,MID(A2,FIND("^^",SUBSTITUTE(A2," ","^^",LEN(A2)-LEN(SUBSTITUTE(A2," ",""))))+1,1024))


This Add-in make it easy to insert the formulas in a new column
http://www.rondebruin.nl/datarefiner.htm



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ruan" wrote in message ...
Hello,

I was able to extract the Last Name from a string, however I am having difficulties extracting the First Name, especially when
there is a Middle Initial involved.

Example: Bond, James P.

I just need to extract "James".

Here is my formula I used for extracting the Last Name -
=UPPER(IF(ISNUMBER(FIND(",",A1)),TRIM(LEFT(A1,FIND (",",A1)-1)),TRIM(LEFT(A1,FIND(" ",A1)-1))))


Thanks
Ruan