+ Reply to Thread
Results 1 to 10 of 10

Using IF and VLOOKUP to compare two values that are not similar (leading zeros for id)

  1. #1
    Registered User
    Join Date
    10-25-2010
    Location
    Toronto
    MS-Off Ver
    Excel 2016
    Posts
    24

    Using IF and VLOOKUP to compare two values that are not similar (leading zeros for id)

    Good morning,
    I am trying to compare values in multiple sheets. Problem is the values generated from multiple databases is not identical. The ID has leading zeros in one, and not in the other; values generated are text in one and code in the other.
    A combination of if and vlookup does not seem to work as I need to get a true or false in a third worksheet that I can give them as validation.
    The formula I am trying to use is in the cell, as text which might help you point me to correct it.
    Thanks in advance,
    Attached Files Attached Files

  2. #2
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Using IF and VLOOKUP to compare two values that are not similar (leading zeros for id)

    This works in your sample:

    B2 of WorkingSheet (or Baseline) =INDEX(Possibility!B:B,MATCH(INDEX(Comparator!B:B,MATCH("*"&A2,Comparator!A:A,0)),Possibility!A:A,0))

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Using IF and VLOOKUP to compare two values that are not similar (leading zeros for id)

    All your Comparator IDs that have leading zeroes are 8 characters long.
    So just use this

    =VLOOKUP(RIGHT("0000000"&A2,8),Comparator!A$1:B$10,2,0)

    to retrieve column B from Comparator sheet

    This assumes ID will be at least 1 character long.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Registered User
    Join Date
    10-25-2010
    Location
    Toronto
    MS-Off Ver
    Excel 2016
    Posts
    24

    Re: Using IF and VLOOKUP to compare two values that are not similar (leading zeros for id)

    Thank you so much, I appreciate all the help.
    I guess I did not express my need correctly. I need to compare Possibility (1) on Baseline, to Possibility on Comparator (Yes), lookup that 1 and Yes are the same on sheet:Possibility and give me a "TRUE" in Working Sheet if identical/same or FALSE if not.

  5. #5
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Using IF and VLOOKUP to compare two values that are not similar (leading zeros for id)

    I don't understand. Perhaps include the desired results in your sample and re-upload it.

    You can manually enter the desired results that you would like the formula to produce.

  6. #6
    Registered User
    Join Date
    10-25-2010
    Location
    Toronto
    MS-Off Ver
    Excel 2016
    Posts
    24

    Re: Using IF and VLOOKUP to compare two values that are not similar (leading zeros for id)

    Thank you.
    Please see sheet titled "2Check" wherein I have tried explaining what result I am looking for.
    Attached Files Attached Files

  7. #7
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Using IF and VLOOKUP to compare two values that are not similar (leading zeros for id)

    Maybe try this at WorkingSheet B2

    =VLOOKUP(A2,Baseline!A$2:B$9,2,)=VLOOKUP(INDEX(Comparator!$B$2:$B$9,MATCH(-A2,INDEX(-Comparator!$A$2:$A$9,),)),Possibility!$A$2:$B$9,2,)

  8. #8
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Using IF and VLOOKUP to compare two values that are not similar (leading zeros for id)

    Try this in B2:

    =A2+0=INDEX(Comparator!A:A,MATCH(INDEX(Possibility!A:A,MATCH(VLOOKUP(A2,Baseline!A:B,2,0)+0,Possibility!B:B,0)),Comparator!B:B,0))+0

  9. #9
    Registered User
    Join Date
    10-25-2010
    Location
    Toronto
    MS-Off Ver
    Excel 2016
    Posts
    24

    Re: Using IF and VLOOKUP to compare two values that are not similar (leading zeros for id)

    Thank you so much, it worked like a charm!

  10. #10
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Using IF and VLOOKUP to compare two values that are not similar (leading zeros for id)

    Glad we could help.

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

+ 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. Vlookup - keeping the leading zeros in a cell to allow the vlookup to work
    By UFBEE1970 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 05-02-2019, 04:41 PM
  2. [SOLVED] Removing leading zeros then sort, then place back original values
    By Eduards in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-24-2019, 11:13 AM
  3. VLookup and leading zeros
    By zloep in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-31-2013, 11:30 AM
  4. Replies: 5
    Last Post: 01-28-2013, 07:29 PM
  5. Replies: 1
    Last Post: 10-25-2012, 05:46 AM
  6. Formatting query, incremental values with leading zeros
    By shockeroo in forum Excel General
    Replies: 5
    Last Post: 04-08-2009, 08:28 AM
  7. Leading Zeros in Numeric Values
    By DBavirsha in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-04-2005, 02:06 PM

Tags for this Thread

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