Substitute character

12Rev79

Board Regular
Joined
Mar 2, 2021
Messages
57
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Dear Experts,

Please is there a way to substitute character like below
old format New Format
A71-DBC-3529_E05101A/F-1 A71-DBC-3529/E05101A_F/1
U71-WOS-0801_B08201L/E-23 U71-WOS-0801/B08201L_E/23
A98-FAC-70221_H06504G/H-84 A98-FAC-70221/H06504G_H/84

Thank you very much for any help appreciated.

12Rev79
 
The sample data format looks pretty consistent. Here is one way of doing it.
Note: If you only need it to work on MS365 then I am sure others can give you more options.

20250221 Substitute Characters 12Rev79.xlsx
ABCD
1OriginalFormulaExpectedMatch
2A71-DBC-3529_E05101A/F-1A71-DBC-3529/E05101A_F/1A71-DBC-3529/E05101A_F/1TRUE
3U71-WOS-0801_B08201L/E-23U71-WOS-0801/B08201L_E/23U71-WOS-0801/B08201L_E/23TRUE
4A98-FAC-70221_H06504G/H-84A98-FAC-70221/H06504G_H/84A98-FAC-70221/H06504G_H/84TRUE
Sheet1
Cell Formulas
RangeFormula
B2:B4B2=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2,"_","/"),"/","_",2),"-","/",3)
D2:D4D2=B2=C2
 
Upvote 0
Solution
@Alex Blakenburg's solution is the simplest to implement and understand... and it will work in any version of Excel. However, if you are working in XL365 only, then this formula would also work...

=TEXTJOIN({"-","-","/","_","/"},,TEXTSPLIT(A2,{"-","_","/"}))
 
Last edited:
Upvote 0
The sample data format looks pretty consistent. Here is one way of doing it.
Note: If you only need it to work on MS365 then I am sure others can give you more options.

20250221 Substitute Characters 12Rev79.xlsx
ABCD
1OriginalFormulaExpectedMatch
2A71-DBC-3529_E05101A/F-1A71-DBC-3529/E05101A_F/1A71-DBC-3529/E05101A_F/1TRUE
3U71-WOS-0801_B08201L/E-23U71-WOS-0801/B08201L_E/23U71-WOS-0801/B08201L_E/23TRUE
4A98-FAC-70221_H06504G/H-84A98-FAC-70221/H06504G_H/84A98-FAC-70221/H06504G_H/84TRUE
Sheet1
Cell Formulas
RangeFormula
B2:B4B2=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2,"_","/"),"/","_",2),"-","/",3)
D2:D4D2=B2=C2
Thank you so much @Alex Blakenburg
Sir, it works perfectly appreciate your help...

Thanks again

12Rev79
 
Upvote 0
@Alex Blakenburg's solution is the simplest to implement and understand... and it will work in any version of Excel. However, if you are working in XL365 only, then this formula would also work...

=TEXTJOIN({"-","-","/","_","/"},,TEXTSPLIT(A2,{"-","_","/"}))

Thanks too @Rick Rothstein Sir, I learned new stuff...you are all great...

I am also using Excel 365
cheers for all your kindness
12Rev79
 
Upvote 0

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