formula to remove a space and replace but depending on the details

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,210
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,

Ok so please help with this formula if you can?

I have names in column B

I need to change the way they are recorded for our new system.

In colunm "B" I have names that are all set up as either sir name and first name or sirname and initial.

I need to reove the space between these words and follow this simple rule.

If the name in the cell (say"B6") has only one digit after the space then replace the space with a full stop "."

examples:

Tony W becomes Tony.W
Jon K = Jon.k
Billy X = Billy.X etc

but if its more than 1 digit remove the space

So:

Tony Wills =TonyWills
Jon Ko = JonKO
Billy Xavia = BillyXavia

please help if you can.
thanks

Tony
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
One option
=IF(SEARCH(" ",B6)=LEN(B6)-1,SUBSTITUTE(B6," ","."),SUBSTITUTE(B6," ",""))
 
Upvote 0
Here's another way:
=SUBSTITUTE(A1," ",IF(LEFT(RIGHT(A1,2))=" ",".",""))
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

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