Forum Discussion

CateMil's avatar
CateMil
Copper Contributor
Jul 22, 2021
Solved

HELP PLS!! VLOOKUP not working at the end of a list

The formula works all the way down my data and then just returns #REF! for the last 4 entries but there is still data to read across both sheets sitting there available and it won't register it. I'm ...
  • Lorenzo's avatar
    Lorenzo
    Jul 25, 2021

    CateMil 

    I didn't pay attention to this previously. In sheet 'WALKING ORDER (2)' [Column1] and [Stock] your formula were (respectively) in row 10 (and then down):

    =IFERROR(VLOOKUP(A10,STOCK[#All],2),0)
    =IFERROR(VLOOKUP(A10,STOCK[#All],7),0)

     

    The problem here is you don't provide https://support.microsoft.com/en-us/office/vlookup-function-0bbc8083-26fe-4963-8ab8-93a18ad188a1 a value for its optional last parameter [range_lookup]. And the default value for the latter is TRUE/1 which means that the data in your lookup table must be ordered/sorted otherwise you get random/inaccurate results. [INGREDIENTS] are +/- well ordered in Table STOCK but the last few "items": CHARCOAL (BAGS) and KEROSENE (LITRES)

     

    I updated your formulas in [Column1] and [Stock] sheet 'WALKING ORDER (2)' so they now say:

    =IFERROR(VLOOKUP(A10,STOCK[#All],2,0),0)
    =IFERROR(VLOOKUP(A10,STOCK[#All],7,0),0)

     

    and magically enough 🙂 this returns the correct SUPPLIER

Resources