I finally figured this one out on my own thanks to maras_mak for helping me with my previous spreadsheet and informing me about Index and Match functions.
However I'd like to know if this was the most efficient way to do it, or if there is a simpler method.
I have a table that lists vehicles, their vehicle identification numbers (VIN), their engine, and a couple other criteria related to the engine so I don't have to remember it. The criteria was easy enough to generate with a few nested IF functions, but I had to lookup and manually enter every engine code. Since I'm only working with a single manufacturer, I figured I could set up a table and automate it.
The formula I came up with pulls the 8th digit from a vin, and looks up the matching character in a table that lists the characters and engine codes. The issue I ran into was that it wasn't playing nicely with just the MATCH and MID function because there was both text and numbers. I eventually came up with this solution that uses an IF statement, ISNUMBER, and VALUE, and now the numbers play nicely.
Formula:
=
INDEX(
Table4,
MATCH(
IF(
ISNUMBER(VALUE(MID(Table1[Vin],8,1))),
(VALUE(MID(Table1[Vin],8,1))),
MID(Table1[Vin],8,1)),
Table4[8th Digit of Vin],0),
2)
Is this the best solution or is there a better way? Sample sheet is attached. Formula is in C2.
Bookmarks