View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Joe_Germany Joe_Germany is offline
external usenet poster
 
Posts: 25
Default separating first and last names

one more thing..

U need to use TRIM() if there is space after the last name
otherwise, u will not get result..

Joe_Germany wrote:
Having seen ur posting, I was trying to get it solved.. but couldnt
extrace the last name.
Then i searched the this group and found one result..

this will give u the last name..
=MID(A1,FIND("~",SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))))+1,255)

But when i came here, bob had already posted one.. i couldnt find any
real difference, but I too got an error from his copy.. I donno why..

Now I have to figure out how it works..

for the first name u can use
=LEFT(A1,SEARCH(" ",A1)-1)

Also u can use =TRIM(A1) to cleanup the name before extracting the
same, although these works fine even without it...

HTH

Joe

Tom G. wrote:
I am receiving an #VALUE error.

Thanks bob, from what I can understand, you are doing a "find" for the ~,
however, this character does not exist. Am I missing something. I am looking
to always use the last word in the column (there is never a comma
delineating the different names - only text).

TIA.


"Bob Phillips" wrote in message
...
=MID(A2,FIND("~",SUBSTITUTE(A2," ","~",LEN(A2)-LEN(SUBSTITUTE(A2,"
",""))))+1,255)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Tom G." wrote in message
...
I have a column with a variety of first and last name variations:

Joe Smith
Joe John Jones
Tom Jack Stuart Apple
Maria Lois Lane
Johann Sebastian Bach


I need to be able to sort them on their last name. Note that there is no
comma separating their names and that there can be any number of names,
HOWEVER, the last name always appears LAST.

Probably, in order to make some sort of order out of this mess, it would
be
best if I create two separate columns: first names, last name.

Any help will be appreciated.

--


cheers,
Tom G