Excel – Does Excel have Find & Replace match placeholder

microsoft excel

I want to use wildcards in Excel Find & Replace dialog, to replace cells with a pattern match. Made up example column:

_4
_44
_13
...

I want to replace these values with:

(4)
(44)
(13)
...

So I tried with _* which finds the pattern succesfully, but I couldn't find anywhere if Excel features match placeholder. For example with regex I would have used brackets and \1 as match placeholder. Does Excel have this feature at all?

Best Answer

Excel's pattern matching capabilities are extremely limited: literal characters, * to match any number of unspecified characters, and ? to match a single unspecified character. There is no native match placeholder capability, either in worksheet functions or in VBA.

However, as Excellll noted, you can use regex in VBA, and can develop user-defined functions that are regex-based.

To access regex in your code, add a reference to the "Microsoft VBScript Regular Expression 5.5" library via the Tools->References selections in the main menu for the Visual Basic code editor.

I have not found any comprehensive documentation for the library, but you can find a lot of bits and pieces - and example code - with a Google search.

Related Question