Solved

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

Posted on 2014-09-21
4
444 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 38

Assisted Solution

by:Gerwin Jansen, EE MVE
Gerwin Jansen, EE MVE 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

860 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