My data looks like this: (single cell): James P. Smith Jr and I want
it to be Smith, James P Jr. Thanks.
These are my formulas:
=LEFT(A40,FIND(" ",A40)-1)
=RIGHT(A40,LEN(A40)-FIND("*",substitute(A40," ","*",LEN(A40)-
LEN(SUBSTITUTE(A40," ","")))))
=IF(ISERR(MID(A40,FIND(" ",A40)+1,IF(ISERR(FIND(" ",A40,FIND("
",A40)+1)),FIND(" ",A40),FIND(" ",A40,FIND(" ",A40)+1))-FIND("
",A40)-1)),"",MID(A40,FIND(" ",A40)+1,IF(ISERR(FIND(" ",A40,FIND("
",A40)+1)),FIND(" ",A40),FIND(" ",A40,FIND(" ",A40)+1))-FIND("
",A40)-1))
If all of your data looks exactly like your example (e.g. FirstName
MiddleInitial LastName Suffix, then you can use this formula (with the name in
A1):
=MID(A1,1+FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),2)),-1+
FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),3))-FIND(CHAR(1),
SUBSTITUTE(A1," ",CHAR(1),2)))&", "&LEFT(A1,FIND(" ",A1))&
MID(A1,FIND(" ",A1),FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),2))-
FIND(" ",A1)+1)& MID(A1,FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),3))+1,255)
But there are a variety of ways that names can be entered. And if you have
names entered with formats other than the way you describe it above, things can
get very complicated. For example,
do all of your names have suffixes?
Do they all have middle initials or names?
Do any have multiple middle initials or names?
If there is a middle name entered, do you want that returned or just the MI?
Is there no punctuation other than a "." following a middle initial?
Any hyphenated last names?
Any with prefixes?
etc.
Rearranging the names can be done, but if the patterns are any more complicated
than the one you show, you will need to define them for us.
--ron