Replace / and bring zero at initial position

James Clear

Board Regular
Joined
Jul 12, 2021
Messages
139
Office Version
  1. 365
  2. 2016
  3. 2013
  4. 2010
Platform
  1. Windows
Hi All,

I want to replace last digit and bring Zero at initial position

for example

21-22/RFL/<10K/AS/1 - it should give me
21-22/RFL/<10K/AS/01 similaraly for
21-22/RFL/<10K/AS/10 it should give me
21-22/RFL/<10K/AS/010
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
If there is always 4 "/"s in the original text like your samples then try ..

22 02 09.xlsm
AB
121-22/RFL/<10K/AS/121-22/RFL/<10K/AS/01
221-22/RFL/<10K/AS/1021-22/RFL/<10K/AS/010
Insert 0
Cell Formulas
RangeFormula
B1:B2B1=SUBSTITUTE(A1,"/","/0",4)


If your data is not as uniform as that then please give some samples that show the sort of variety that you actually have as well as the expected results (preferably with XL2BB)
 
Upvote 0
Solution
If there is always 4 "/"s in the original text like your samples then try ..

22 02 09.xlsm
AB
121-22/RFL/<10K/AS/121-22/RFL/<10K/AS/01
221-22/RFL/<10K/AS/1021-22/RFL/<10K/AS/010
Insert 0
Cell Formulas
RangeFormula
B1:B2B1=SUBSTITUTE(A1,"/","/0",4)


If your data is not as uniform as that then please give some samples that show the sort of variety that you actually have as well as the expected results (preferably with XL2BB)
Thanks Peter ,

I did this long formula

REPLACE(A2,SEARCH("^",SUBSTITUTE(A2,"/","^",4)),1,"/0")
 
Upvote 0
You're welcome. Thanks for the follow-up. (y)

Your formula looks fine - but now you have a shorter option. :)
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,520
Members
449,088
Latest member
RandomExceller01

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