Replace multiple spaces in names with different values

BiggusDoggus

Board Regular
Joined
Jul 7, 2014
Messages
91
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a substantial (and dynamic) list of names that I'm needing to transform into email addresses.

For names like Bob Smith, and even those with hyphens (Sarah-Jane Brown), it's no issue:

=LOWER(CONCAT(SUBSTITUTE(SUBSTITUTE(C16342," ","."),"-",""),"@abc.com"))

End result = bob.smith@abc.com, sarahjane.brown@abc.com

However, I also have names such as Stephen Ray Jones. I need this name to be stephenray.jones@abc.com.

How would I do this please? Essentially, remove the first space, and make the second space a ".".
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Upvote 0
Solution
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

For example if you happen to have the latest 'TEXT' functions (not too many have them just yet though), you could also do it like this - Col B. (Also allows for one-word names if relevant)
I have also suggested an adjustment to @Colo's formula in case single-word names are possible - Col C

Cell Formulas
RangeFormula
B1:B6B1=LOWER(SUBSTITUTE(SUBSTITUTE(IFNA(TEXTBEFORE(A1," ",-1)&"."&TEXTAFTER(A1," ",-1),A1)," ",""),"-",""))&"@abc.com"
C1:C6C1=LOWER(SUBSTITUTE(SUBSTITUTE(IFERROR(SUBSTITUTE(A1, " ", ".", LEN(A1) - LEN(SUBSTITUTE(A1, " ", ""))),A1)," ",""),"-","")) & "@abc.com"
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,175
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top