Link to home
Start Free TrialLog in
Avatar of get-ADuser -F ($_.Name -eq "Todd")
get-ADuser -F ($_.Name -eq "Todd")Flag for United States of America

asked on

Extract First and Last name from a string in a cell. Hope there is a function in EXCEL to do this

I have a string value in a cell from Active Directory.  In a recent question I was able to extract the full name from this string

CN=John Doe,CN=Users,DC=mydomain,DC=int     Using this function.  =MID(A1,4,FIND(",",A1)-4).   And it works great.  

Now I would like to extract the first name and last name, each in its own cell.  In other words, "John" in the B1cell and "Doe" in the C1 cell.  This way I can import to a database table.  Any help is greatly appreciated.
ASKER CERTIFIED SOLUTION
Avatar of Glenn Ray
Glenn Ray
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What if the name is "John Burdon Sanderson Haldane" (a real person)?
^Yup!  Or "John Jacob Jingleheimer Schmidt"
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of get-ADuser -F ($_.Name -eq "Todd")

ASKER

No middle or multiple names I am aware of.  
But Good God if that happens I will kill somebody!...  Good thing I am the Active Directory person.  If it happens it would definitely be my fault. Bad enough the women who get divorced and want new email boxes AND username signons AND display name changes!  
lol,,, Now you guys are going to make me check if someone did do that!  But for now, I think I can figure out that exception to the rule.  So much appreciated.  Function works great!  and the "what if" question.
WOW Glenn you are brilliant.  Especially on the last post.  I will use that for C1 (Just In Case).  How you know that huge function is beyond me, but wow.  You are truly the expert!!!!...   You saved me big time!
Exceptional Expert!
Thanks.  It looks gawdawful, but the trick is to break the function up into smaller parts.  I've attached an example workbook that shows that for future reference.

-Glenn
EE-ExtractName.xlsx