Any way to do multiple SUBSTITUTE commands in one cell?

boznian

Board Regular
Joined
Mar 25, 2003
Messages
167
I have AplphaNumeric part numbers that sometimes contain hyphens or decimals. In order to make them more searchable (since people don't always use the hyphens or decimals properly when they search) I would like to create all the possible variants of the part number, but with one formula.

So AHW18.787 becomes AHW18 787 and AHW18787 with

=SUBSTITUTE(A1,"."," ") and
=SUBSTITUTE(A1,".","") respectively, and

AHRTW-A18-7007 becomes AHRTW A18 7007 and AHRTWA187007 with

=SUBSTITUTE(A1,"-"," ") and
=SUBSTITUTE(A1,"-","").

What I need to be able to do is merge these formulas into one, so that no matter what format the part number is in A1, I get a version of it with spaces in B1, and a version of it with no spaces in C1. I just have not been able to nest it all together - is it even possible with this command?

Thx
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Use this

=SUBSTITUTE(SUBSTITUTE(A1,"-",""),".","")

This will remove hyphens and full stops leaving you with the other characters.
This way it doesnt matter whether hyphens or full stops are initally entered.
 
Upvote 0
Try

=SUBSTITUTE(SUBSTITUTE(A1, "-", ""), ".", "")
 
Upvote 0
Try this for B1:

=SUBSTITUTE(SUBSTITUTE(A1,"."," "),"-"," ")

And this for C1:

=SUBSTITUTE(B1," ","")
 
Upvote 0
All Good!!

Thanks a bunch everyone - I don't know why I have so much trouble w/ that pesky syntax...

Cheers
 
Upvote 0

Forum statistics

Threads
1,213,494
Messages
6,113,974
Members
448,537
Latest member
Et_Cetera

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