I'm trying to figure out a way to replace/substitute/regex a specific pattern in an Excel table with the corresponding value from another table. The pattern, which appears x times inside a text block, always follows these rules:
{[4,9]{1}[0-9]{5}}
(enclosed in curly brackets, a "4" or a "9" followed by 5 numbers, each of which can be anything from 0 to 9, such as "{412345}" or "{961723}".)
The desired formula should then strip the brackets out, lookup the number in another table, and return the corresponding entry from another column.
I've managed to accomplish this with four predefined numbers:
However, I need to expand the formula to include any number matching the pattern. I suppose a VBA UDF is the way to go, though I haven't got a clue how to do it...
PS: if anyone is interested in pushing the limits a little further, the next step I'll have to deal with is to add .X to the numbers inside the curly brackets, where X represents the table within which the values have to be checked against. For example: "{412345.2}" would mean "check 412345 in table 2 and replace with found value", and "{912345.5}" should be "check 912345 in table 5 and replace with found value".