Say I need write code in VBA to match the string "revenues" in a different worksheet that may show a similar string in a column range though not perfectly matching (it may be "total revenues", "rev", "ABC revenues"). What the best strategy to approach the problem?
Asked
Active
Viewed 44 times
-1
-
Are you trying to find the similar matches or only match exactly? If the first consider the microsoft free fuzzy add-in and build your tables of related terms. If the later look at Find with xlWhole. You might consider Find xlPart and Instr/InstrRev for the former but I would go with fuzzy for flexibility. More info on Fuzzy in my answer [here](https://stackoverflow.com/a/49101479/6241235) – QHarr May 17 '18 at 04:56
1 Answers
0
I'd probably write a VB function that matched the (lower case-cast) strings to a list of fragments, or detected fragments in cell value. While you could also try to use Regex, I doubt that you have consistent enough input to generate a rule that would pick out most examples. You'll probably need a countermeasure to check against false positives as well.
Good Luck!

Sean Munson
- 343
- 2
- 9