How to remove all non-alphanumeric characters from cells?

henway

Board Regular
Joined
Jul 19, 2006
Messages
85
I have 20,000 lines of parts with all sorts of characters like ()@.#%& in them. I need a column next to it showing each cell's "short" equivalent which has all of these stripped.
Thus "03(1.0)7FLZ-SM1-TB" needs to be 03107FLZSM1TB

any ideas other than making multiple columns, each with:
=SUBSTITUTE(A1,"-","")
=SUBSTITUTE(A1,"(","")
=SUBSTITUTE(A1,"-")"")
.
.
.

and then use the final? Is there a way to put them all into one formula?

Thanks!
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Wow! That works great.

Now I get to figure out all the additional functionality a add-in program has!
 
Upvote 0
A few years later, admittedly, but for those with the same problem try the nested SUBSTITUTE formula:
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(B2,"/",""),",",""),"(",""),")",""),"-",""),".",""),":","")," ","")

To clarify it, we can use Alt+Enter to put each bit on a new line in the same cell. In this case we have 8 x SUBSTITUTE( and 8 non-alphanumeric characters. To add more, we add a {SUBSTITUTE(} at the top and a {,"[your character]","")} at the bottom:
=

SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
A1
,"/","")
,",","")
,"(","")
,")","")
,"-","")
,".","")
,":","")
," ","")
 
Upvote 0

Forum statistics

Threads
1,214,996
Messages
6,122,636
Members
449,092
Latest member
bsb1122

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