Solved

Excel Formula add SUBSTITUTE(B1;" "."") to formula from splitting displayname

Posted on 2014-09-21
4
435 Views
Last Modified: 2014-09-21
hi,

In Cell "G2" i have this formula

=TRIM(MID(C2,FIND(",",C2,1)+1,IFERROR(FIND("(",C2,1)-FIND(",",C2,1)-1,LEN(C2)))))

C2 is:  Jones, Mike

The result in G2 is  "Mike"   Firstname

in Cell "H2" i have this formula

=MID(C2,1,(SEARCH(",",C2))-1))

The result in H2 is  "Jones"   Lastname

so far so good but how can replace spaces or - or with "." when the displayname looks like that:

Jones-ryan, Mike Michael         Result G2 should be mike.michael and H2 jones.ryan
Jones ryan, Michael Mike         Result G2 michael.mike and H2 jones.ryan
Jones, Dimitri Jack Michael      Result G2 dimitri.jack.michael and H2 jones

The last one is different
Jones, Michael Jack (12345)      Result G2 michael.jack and H2 jones.12345


I tried different formula with =SUBSTITUTE(G2;" ";"") but still not working

Could anyone assist how to solve that, please?

Any help would be greatly appreciated.
Mandy
0
Comment
Question by:Mandy_
  • 2
4 Comments
 
LVL 37

Assisted Solution

by:Gerwin Jansen
Gerwin Jansen earned 100 total points
ID: 40335291
For all but the last one, this should work:

=SUBSTITUTE(SUBSTITUTE(TRIM(MID(C3,FIND(",",C3,1)+1,IFERROR(FIND("(",C3,1)-FIND(",",C3,1)-1,LEN(C3))))," ","."),"-",".")

and

=SUBSTITUTE(SUBSTITUTE(MID(C3,1,(SEARCH(",",C3))-1)," ","."),"-",".")

But the 'different' one -> do the numbers belong to the last name? If so, why are they the 'first name' field?
0
 
LVL 27

Accepted Solution

by:
Glenn Ray earned 400 total points
ID: 40335478
For the first name (deep breath):
=SUBSTITUTE(SUBSTITUTE(TRIM(IF(ISERROR(FIND("(",C2)),MID(C2,FIND(",",C2)+2,30),MID(C2,FIND(",",C2)+2,FIND("(",C2)-FIND(",",C2)-3))),"-",".")," ",".")

For the last name (inhale):
=SUBSTITUTE(SUBSTITUTE(TRIM(IF(ISERROR(FIND("(",C2)),LEFT(C2,FIND(",",C2)-1),LEFT(C2,FIND(",",C2)-1)&"."&MID(C2,FIND("(",C2)+1,LEN(C2)-FIND("(",C2)-1))),"-",".")," ",".")

If there are compound last names like:
Washington Carver, George (123)
the last name will be
Washington.Carver.123

Side note:  These look like data from Active Directory, but I too am confused that the number (probably representing identical name listings) is after the comma.  In our system, for example, the numbers are concatenated to the last name (ex., Ray2).


Regards,
-Glenn
0
 
LVL 2

Author Closing Comment

by:Mandy_
ID: 40335483
you both are my personal heroes. Thank you muchisimo ;-)
0
 
LVL 27

Expert Comment

by:Glenn Ray
ID: 40335490
You're welcome.  Looks like quite a project you've got going there.  Moving to new email servers, are we? :-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now