Need a formula to lookup from values on a list with no set delimiters
So here is the formula so far. First, it does not work. Second, I do not know how to fix it.
Here is the problem: I have a column in an excel table that contains a registration number. The registration number always has a prefix that permits you to know which country it is from. The prefix is not a set number of characters; it is not a set character; nor is there a set delimiter. There is a "-" in many, but not all, and the "-" is not always at the end of the prefix. For instance, N1235 is from the US, and C3-345d is from Andorra.
I'm using a helper column to locate and return the prefix and then a third column to look the prefix up in a table and return the country of origin. This formula is in the helper column.
If I group if statements, I think there would be too many. I almost need to do it backwards from normal, like excel read this entire list of prefixes and decide which one it is.
Here are some sample prefixes and their countries:
| Regn Prefix | Country Name |
|---|---|
| B-H | China, Hong Kong |
| B-K | China, Hong Kong |
| B-L | China, Hong Kong |
| B-M | China, Macau |
| C2- | Naura |
| C3- | Andorra |
| C6- | Bahamas |
| CX | Christmas Islands |
| F-O | Reunion Island |
| F-OD | New Caledonia |
| F-OG | Guadeloupe |
| F-OG | Martinique |
| F-OH | Tahiti |
| HL | Korea, Rep. of |
| JA | Japan |
| N | United States of America |
| V8- | Brunei |
| VH- | Australia |
| VP-B | Bermuda |
| VQ-B | Bermuda |
| VP-C | Cayman Islands |
| VP-F | Falkland Islands |
| VP-LMA-LUZ | Montserrat |
| VP-LV | British Virgin Islands |
| VQ-H | St. Helena |
| VQ-T | Turks and Caicos Islands |
| XC- | Mexico |
| XT- | Burkina Faso |
| 2- | Guernsey |
| 3X- | Guinea |
| 5H- | Tanzania |
[link] [comments]
Want to read more?
Check out the full article on the original site