+ Reply to Thread
Results 1 to 10 of 10

VLookup returns N/A or wrong value

  1. #1
    Registered User
    Join Date
    06-10-2011
    Location
    helsinki, finland
    MS-Off Ver
    Excel 2007
    Posts
    15

    VLookup returns N/A or wrong value

    hey there,
    I am working on an excel sheet with around 21,000 rows and using VLOOKUP function to compare two worksheets and get a common value. I need to lookup the column C (Long code print format) in sheet one and compare it to sheet 2 to find the amount corresponding. The results are displayed in Sheet 1 column D. I have attached a dummy sheet whereby if i use the formula =VLOOKUP(C:C,Sheet2!A:C,3,FALSE) it works like a charm and gives me the correct amount, but if i implement it on the whole sheet, it gives me a N/A result.

    I think its also worth noting that if i use TRUE in the function, it gives me a result that is a row above what is expected. What could be the reason behind that?
    Attached Files Attached Files
    Last edited by vindieselgal; 08-08-2011 at 07:15 AM.

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: VLookup returns N/A or wrong value

    Why are you looking up C:C, not just C2?

  3. #3
    Registered User
    Join Date
    06-10-2011
    Location
    helsinki, finland
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: VLookup returns N/A or wrong value

    hey,

    that is just one of the methods i used. but whether i use C2 or the whole column C:C i still get the same result. Like i said on this example, it works well, but when i try to implement on the 21,000 rows, well....thats where am still banging my head...

  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: VLookup returns N/A or wrong value

    Could it be that in your live data you have part numbers that are text and you're trying to match them against part numbers that are numeric? Even if the values look the same VLOOKUP doesn't treat them as the same.

    You'd really have to show us an example of your problem.

  5. #5
    Registered User
    Join Date
    06-10-2011
    Location
    helsinki, finland
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: VLookup returns N/A or wrong value

    hey..
    i think that is exactly the problem. i attached a dummy excel file with info for sheet1 and sheet2 at the beginning of this thread and as you can see, the data differs in all the columns. i have tried getting rid of trailing and leading spaces. Still no difference.
    the boolean value FALSE returns a N/A while TRUE returns a value that is a row above the desired result... hope this clarifies my point.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: VLookup returns N/A or wrong value

    =VLOOKUP(C2,Sheet2!A:C,3,FALSE) works fine for me. It does, however, return #N/A whenthe search value is not present.

    I think you need to provide a more representative sample where the results are not as expected.

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  7. #7
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: VLookup returns N/A or wrong value

    As far as your example goes, the results seem normal to me

  8. #8
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: VLookup returns N/A or wrong value

    Yes, I saw the dummy example, but as the formula you're using works in that example it doesn't really show the problem.

    Changing the FALSE to a TRUE tells Excel you're searching on sorted data and that it should return the nearest value, so it doesn't really help, sorry.

  9. #9
    Registered User
    Join Date
    06-10-2011
    Location
    helsinki, finland
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: VLookup returns N/A or wrong value

    i agree but it didnt work on the whole sheet. Good news is that i got it to work by getting rid of the leading, trailing and excessive spaces. For the green ones in Excel functions, ASAP Utilities are a Godsent and can be downloaded at http://www.asap-utilities.com/downlo...-utilities.php . here they got macros that can help perform these functions. thanks alot y'all for your help :-)

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: VLookup returns N/A or wrong value

    If your search data doesn't match the lookup table, you're not going to get matches.

    You could also try:

    =VLOOKUP(TRIM(C2)&"",Sheet2!A:C,3,FALSE)


    Regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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