+ Reply to Thread
Results 1 to 9 of 9

Matching 8th Digit of Vin to Table

Hybrid View

  1. #1
    Registered User
    Join Date
    10-15-2019
    Location
    Twin Falls, Idaho
    MS-Off Ver
    2016
    Posts
    4

    Matching 8th Digit of Vin to Table

    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: copy to clipboard
    =
    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.
    Attached Files Attached Files
    Last edited by Takanix; 10-26-2019 at 08:24 PM.

  2. #2
    Forum Contributor
    Join Date
    10-30-2003
    Location
    Singapore
    MS-Off Ver
    Excel 2019
    Posts
    197

    Re: Matching 8th Digit of Vin to Table

    Formula in C2, copied down :

    =LOOKUP(1,-FIND(MID(A2,8,1),A$11:A$17),B$11:B$17)

    Regards

  3. #3
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Matching 8th Digit of Vin to Table

    Looks like the issue was when you extract the 8th string, the string data type is treated as text. If I were you, I would just insert a helper column to the reference table to convert all the lookup values to string. =TEXT([@[8th Digit of Vin]],"@") Then a simple INDEX/MATCH should return the correct values. =INDEX(Table4[Eng Code],MATCH(MID(Table1[@Vin],8,1),Table4[X],0))

  4. #4
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Matching 8th Digit of Vin to Table

    Would you mind to use Array formula ?

    =
    INDEX(
    Table4,
    MATCH(
    MID(A2,8,1),
    TEXT(Table4[8th Digit of Vin],"0"),0),
    2)

    Press Ctrl-Shift-Enter
    PS: Use A2 instead of Table1[Vin]


    Regards.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,765

    Re: Matching 8th Digit of Vin to Table

    This non-array formula also works:

    =IFNA(VLOOKUP(MID(Table1[@Vin],8,1),Table4,2,0),VLOOKUP(MID(Table1[@Vin],8,1)+0,Table4,2,0))
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  6. #6
    Registered User
    Join Date
    10-15-2019
    Location
    Twin Falls, Idaho
    MS-Off Ver
    2016
    Posts
    4

    Re: Matching 8th Digit of Vin to Table

    Thanks for all the help in setting up a simpler formula. I was able to get both Bosco and AliGW's formula's to work with my original information. Everything sorts and works perfectly. This will certainly make searching for the correct engine easier and knowing what a fair price is.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,765

    Re: Matching 8th Digit of Vin to Table

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  8. #8
    Registered User
    Join Date
    03-27-2025
    Location
    iowa
    MS-Off Ver
    16.0.1872342301
    Posts
    5

    Re: Matching 8th Digit of Vin to Table

    what table did you use as your source for the vin decode? I am trying to do this same thing for our customer list as we transition to new owners to ensure data transfers

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,765

    Re: Matching 8th Digit of Vin to Table

    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar or even the same as this thread, we have a rule that you open your own thread on the issue and do not piggy back another member's thread.

    Please see Forum Rule #1 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread

    Administrative Note:

    Is your forum profile up-to-date and showing ONLY the oldest Excel PRODUCT that you need this to work for? Newest could be one of several things ...

    Members will tailor the solutions they offer to the Office PRODUCT (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date in this respect. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. If your product is for Mac, please also state this.

    The four most recent Excel products are Excel 2019, Excel 2021, Excel 2024 and MS365 - if you are using MS365, please give this name along with the version number in your profile (e.g. MS365 Version 2306). This is in the About Excel section further down the Account page.

    Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Color a single digit in a mult-digit number cell
    By Phyllis in forum Excel General
    Replies: 8
    Last Post: 09-30-2022, 04:22 PM
  2. Replies: 1
    Last Post: 04-18-2019, 01:35 AM
  3. Replies: 6
    Last Post: 02-03-2019, 06:05 AM
  4. Bank Recon - How to convert 8 digit formatted check numbers to 6 digit
    By Quisp in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-21-2017, 09:55 PM
  5. [SOLVED] LOTTERY FILTER#4, Find if 1 Digit Sum of 2 Digit or 3 Digit, Single Cell w/ dash
    By david gonzalez in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-08-2014, 12:57 AM
  6. Take first digit from code and match to table
    By unclejemima in forum Excel General
    Replies: 1
    Last Post: 05-06-2013, 06:48 PM
  7. Replies: 2
    Last Post: 06-17-2010, 08:36 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1