Is there anyway to do the equivalent to VLOOKUP in excel?

I'm looking to do the equivalent of VLOOKUP in excel to convert state codes into state names within keyboard maestro.

NY -> New York
CA -> California
etc.

How would I do this?

Yep, this can be easily done using RegEx.
See this example which you should be able to adapt for your use case:

MACRO: Replace Text with Numbers (or, Lookup Data Using RegEx) [Example)]

Here's my industrial strength solution for states and their abbreviations. I use Associated Press state abbreviations as well as postal abbreviations so each state has two abbreviations in addition to its full name.

This macro substitutes the selection for any of the three. F2 substitutes the full name, Control-F2 substitutes the AP abbreviation and Option-F2 substitutes the two-character postal abbreviation.

States- Abbreviations.kmmacros (9.9 KB)

2 Likes

Just expanded on this solution with one that includes month names, abbreviations and numeric representations:

1 Like