Find & Replace with wildcards returning original text

Frogy

New Member
Joined
Oct 5, 2011
Messages
4
I want to be able to part of string that was found with wild cards, but maintain the values that the wild cards replaced.

I have data that may contain strings of the following form

xxx, [abcd, efgh], xxx

I want to be able to replace this with the following string

xxx, [abcd/efgh], xxx

Where abcd and efgh will be differnt in all instances.

Would like something like

Find [*,*]
Replace [*/*]

where the replace returns the original values in the abcd & efgh positions.

I don't care if it is done directly in excel or in vba code.

Any ideas?

Thanks
 
Last edited:

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Can we depend on always finding the brackets and that there will always be only one set of brackets?
 
Upvote 0
Also, the abcd & efgh strings can vary in length (usually 4 - 6 characters) and there may or may not be a space after the comma.

Thanks
 
Upvote 0

Forum statistics

Threads
1,215,453
Messages
6,124,930
Members
449,195
Latest member
Stevenciu

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