Inserting two periods into string of Text

JCasco

New Member
Joined
Feb 17, 2022
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hey guys I'm having a hard time figuring out how to add two periods into a string of text.
the column looks like this: A0642000403 and I'm trying to add two periods to format it like this: A0642.0004.03
All strings of text are the same length and need the periods in the same place.
I can add one period using substitute code but having a hard time with two of those playing nice, I'm guessing because it adds the period in there and might be messing with the second portion of the substitute code.

Any Suggestions?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
using substitute code
As "code" (vba expression), Left("A0642000403",5) & "." & Mid("A0642000403",6,4) & "." & Right("A0642000403",2) where you replace the value with a reference to the value.
EDIT
If you mean 'formula' then you have that too.
 
Upvote 0
=REPLACE(REPLACE(A1,6,0,"."),11,0,".")
Worked perfect, thank yo so much! I didn't realize you could just add on that second portion without having to add & in the code!
 
Upvote 0
As "code" (vba expression), Left("A0642000403",5) & "." & Mid("A0642000403",6,4) & "." & Right("A0642000403",2) where you replace the value with a reference to the value.
EDIT
If you mean 'formula' then you have that too.
Thank you so much!
 
Upvote 0
Worked perfect, thank yo so much! I didn't realize you could just add on that second portion without having to add & in the code!

You're welcome, thanks for the feedback.
 
Upvote 0
Seems like the more I hang around here, the more I see functions in Office apps with exactly the same name yet different requirements. This is why I'd probably never think of that one on my own (at least before now):
Access - Replace(expression, find, replace [, start ] [, count ] [, compare ] )
 
Upvote 0
As "code" (vba expression), Left("A0642000403",5) & "." & Mid("A0642000403",6,4) & "." & Right("A0642000403",2) where you replace the value with a reference to the value.
I know the OP ended up wanting a formula, but I thought you would find it interesting that (If the text values are always 11 characters long) the VBA expression can be much more compact...

Format("A0642000403", "@@@@@.@@@@.@@")
 
Upvote 0
All this new stuff I'm learning - and no need for it really. Gone are the days when I might have been called back to work for Access & Excel programming. Keeps the old noodle from wilting, I guess (I meant my brain, by the way). :oops:
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,600
Members
449,038
Latest member
Arbind kumar

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