Formula to Replace Wildcard Characters in a String

Bob_W

New Member
Joined
Jun 15, 2017
Messages
9
So, based on a good amount of previous searching I've almost created a nested formula which does what I need, but I am currently falling at the last fence! Hopefully someone here can help out.

I am trying to remove all non-alpha characters from a text string and through a huge nest of SUBSTITUTE functions I have removed all the numerical, punctuation, double byte characters and spaces, from my starting data to get to a string with just alpha-characters and those which excel considers wildcards too (? and *).

I have also discovered that with a combined REPLACE/SEARCH function I can remove the first instance of a wildcard but where there are multiple instances I'm stumped!! Any ideas?? :confused:

Example of original string:
"TAMINITRASFORMATORIS.R.L.?33VIAEMILIAN.3720077MEL?"

Example string after cleaning:
"TAMINITRASFORMATORISRL?VIAMILIANMEL?"

=REPLACE(A2),SEARCH("~?",A2),1,"") will remove the first instance of ? but not the second.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Sadly not Eric. SUBSTITUTE doesn't work with wildcards, there don't seem to be many functions that do.

REPLACE and SEARCH are the only two i've found so far that do and for excel not to treat it as a wildcard, you need the ~ preceding the ?.
 
Upvote 0
I stand corrected! :eek:

Not sure why or how, but at some point in the last year I convinced myself that didn't work and have been looking for alternative ways to do the substitution. Lesson here is to always recheck your workings!

What a gigantic waste of time that was!!

Thanks for your help enlightening me!
 
Upvote 0

Forum statistics

Threads
1,215,409
Messages
6,124,743
Members
449,186
Latest member
HBryant

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