text field


Posted by Rich on February 05, 2002 5:14 AM

How do you extract last name from a name field first,MI, last name. MI may or may not be present. Thanks

Posted by Aladin Akyurek on February 05, 2002 6:15 AM


=RIGHT(A1,LEN(A1)-SEARCH("@",SUBSTITUTE(A1,",","@",LEN(A1)-LEN(SUBSTITUTE(A1,",","")))))

where A1 houses an entry of interest like John, M, Doe or John,Doe.

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

Posted by rich on February 05, 2002 6:37 AM

:sorry i mislead you there are no comma only spaces between first mi last - how do i modify?




Posted by Aladin Akyurek on February 05, 2002 8:28 AM

Just replace each "," with " ". It becomes after replacement:

=RIGHT(A1,LEN(A1)-SEARCH("@",SUBSTITUTE(A1," ","@",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))

========= : =RIGHT(A1,LEN(A1)-SEARCH("@",SUBSTITUTE(A1,",","@",LEN(A1)-LEN(SUBSTITUTE(A1,",","")))))