+ Reply to Thread
Results 1 to 20 of 20

Vlookup look up data value one table to find in another

  1. #1
    Registered User
    Join Date
    06-20-2018
    Location
    Sarasota,Fl
    MS-Off Ver
    13
    Posts
    28

    Vlookup look up data value one table to find in another

    Hi,

    I'm can't seem to fix the formula getting #n/a data mismatch. Looking up date base on employee number (text) finding code and retrieve that code to lookup the value for that code in a second table.

    =VLOOKUP(VLOOKUP(A8,TL_LOOKUP,3,0),WC_LOOKUP,2,0)
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Vlookup look up data value one table to find in another

    Hi, welcome to the forum

    your lookup range is only the 1st 2 rows of your 3-row table
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Vlookup look up data value one table to find in another

    is this what you are looking for? =IFERROR(VLOOKUP(A8,TL_LOOKUP,3,0),VLOOKUP(A8,WC_LOOKUP,2,0))
    but it still returns #N/A because it appears your TL_lookup does not extend far enough down col A to get that info.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  4. #4
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Vlookup look up data value one table to find in another

    Range for TL_LOOKUP is wrong.
    It should be A3:C5.
    You have it as A3:C4
    1. Click on the * Add Reputation if you think this helped you
    2. Mark your thread as SOLVED when question is resolved

    Modytrane

  5. #5
    Registered User
    Join Date
    06-20-2018
    Location
    Sarasota,Fl
    MS-Off Ver
    13
    Posts
    28

    Re: Vlookup look up data value one table to find in another

    I did change the cell to include the last record entered If I manually type the numbers in this formula this works. However, the data is pulled from a database in text causing the data mismatch.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Vlookup look up data value one table to find in another

    You are specifying the data from a named range - the named is 1 row short

    A
    B
    C
    3
    124
    JOHNSON,T
    5606
    4
    137
    MICHAELS,K
    8810
    5
    065
    SIMPSON,J
    8742
    6
    7
    8
    65
    0.54


    TL_LOOKUP in your file has the range
    =Sheet1!$A$3:$C$4
    it needs to be
    =Sheet1!$A$3:$C$5

  7. #7
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Vlookup look up data value one table to find in another

    you can do things to change items from text to numeric if there is a problem.
    BUT, I put this formula in an empty cell =A8=A5 and it returned true so that means the 65 in A8 and the 065 in A5 match. And clicking on A5 it shows that it has "special" formatting that is showing it with a leading zero.
    using a multiplication of *1 can change a cell from text to numeric such as =C3*1 will take the 5606 from text to numeric.
    But a text will also work in the formula I gave you, so if you put =c3 into A8, it will return the value from the Admin tab.

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Vlookup look up data value one table to find in another

    Quote Originally Posted by Sambo kid View Post
    ... I put this formula in an empty cell =A8=A5 and it returned true so that means the 65 in A8 and the 065 in A5 match. And clicking on A5 it shows that it has "special" formatting that is showing it with a leading zero.
    I did the exact same thing

  9. #9
    Registered User
    Join Date
    06-20-2018
    Location
    Sarasota,Fl
    MS-Off Ver
    13
    Posts
    28

    Re: Vlookup look up data value one table to find in another

    I have retried the raw data from SQL server as the data is populated to spreadsheet; still getting #n/a error
    Attached Files Attached Files

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Vlookup look up data value one table to find in another

    Now the range is not wide enough. The inner VLOOKUP is looking into col 3, but the range only has 2 cols

    Also, you now DO have text strings in your data, but are trying to find a numeric

    =IFERROR(VLOOKUP(""&A8,TL_LOOKUP,3,0),VLOOKUP(A8,WC_LOOKUP,2,0))

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,972

    Re: Vlookup look up data value one table to find in another

    =A8=A3 returns TRUE, so the VLOOKUP should work. The named range references the correct array. What are we missing?

    EDIT: Ugh! Missed that. As Ford says, the range needs to be one column wider.
    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.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  12. #12
    Registered User
    Join Date
    06-20-2018
    Location
    Sarasota,Fl
    MS-Off Ver
    13
    Posts
    28

    Re: Vlookup look up data value one table to find in another

    Thanks that worked!

  13. #13
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Vlookup look up data value one table to find in another

    well one problem is that this portion of the formula is wrong...
    VLOOKUP(A8,TL_LOOKUP,3,0) your TL_LOOKUP range is A3 to B5 but your vlookup is telling the formula to go over 3 columns to column C but that is outside of the range so that will return a NA. you need to correct your range.

    BTW, none of those replies were here when I started typing.
    again, too slow.

  14. #14
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Vlookup look up data value one table to find in another

    @ Sambo, been there, done that
    @ Ali, I almost missed hat 1 too

  15. #15
    Registered User
    Join Date
    06-20-2018
    Location
    Sarasota,Fl
    MS-Off Ver
    13
    Posts
    28

    Re: Vlookup look up data value one table to find in another

    After reviewing, the formula retrieve the WC_code correctly, we are trying the get the corresponding value for that code.
    Attached Files Attached Files

  16. #16
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,972

    Re: Vlookup look up data value one table to find in another

    This is the formula you need:

    =IFERROR(VLOOKUP(VLOOKUP(""&A8,TL_LOOKUP,3,0),WC_LOOKUP,2,0),"")

    However, there are leading spaces in the first column of the admin lookup table, which need removing, then it will work.

  17. #17
    Registered User
    Join Date
    06-20-2018
    Location
    Sarasota,Fl
    MS-Off Ver
    13
    Posts
    28

    Re: Vlookup look up data value one table to find in another

    My formulas to remove leading zeros have not worked.

  18. #18
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,972

    Re: Vlookup look up data value one table to find in another

    What does this mean? Are you still in need of help?

  19. #19
    Registered User
    Join Date
    06-20-2018
    Location
    Sarasota,Fl
    MS-Off Ver
    13
    Posts
    28

    Re: Vlookup look up data value one table to find in another

    Yes, I can't get the formula to work. I've tried several methods to remove leading zeros and still no luck.

  20. #20
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,972

    Re: Vlookup look up data value one table to find in another

    What did you try?

+ 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. Problems exporting a table - find/replace data inside a table in word through excel vba
    By elvagonumero1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-28-2018, 04:33 PM
  2. Replies: 0
    Last Post: 12-26-2013, 01:12 PM
  3. Replies: 8
    Last Post: 04-22-2013, 06:30 PM
  4. Using a ADDRESS/MATCH with VLOOKUP to find a value in a table
    By stturn in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-05-2013, 02:42 PM
  5. (ask) Vlookup to find max in table list.
    By sr_88 in forum Excel General
    Replies: 3
    Last Post: 08-21-2012, 01:39 AM
  6. Adding data to a table, from another table..reverse vlookup??
    By Speshul in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-24-2012, 04:06 AM
  7. vlookup function-Can vlookup command find the data from the 5 sheets.
    By Rishab shah in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 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