Why is This?

  • Thread starter Thread starter John
  • Start date Start date
J

John

I have the following lookup, which doesn't return by expected value

=IF(L6="","",VLOOKUP(L6,Masters!A1:B23,2))


L6 = Drop down list from a Range name "Stores"
Masters A = The Range Name "Stores"
Masters B = The values I want returned

It only seems to work if Column A is sort alphabetically, is that correct? I
didn't think this had to be the case


Thanks
 
=IF(L6="","",VLOOKUP(L6,Masters!A1:B23,2,False))

should work regardless

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Hi

About "Why":

VLOOKUP with 4th parameter TRUE or 1 returns nearest match. Data in lookup
range must be sorted on leftmost column - otherwise the result is
unpredictable.

VLOOKUP with 4th parameter FALSE or 0 returns first exact match. Data in
lookup range can be unsorted. When there is no exact match, the function
returns error - because this mostly it will be clever to use error trapping.
=IF(ISERROR(VLOOKUP(...)),"",VLOOKUP(...))


Arvi Laanemets
 
Thanks for the explanation Arvi

Arvi Laanemets said:
Hi

About "Why":

VLOOKUP with 4th parameter TRUE or 1 returns nearest match. Data in lookup
range must be sorted on leftmost column - otherwise the result is
unpredictable.

VLOOKUP with 4th parameter FALSE or 0 returns first exact match. Data in
lookup range can be unsorted. When there is no exact match, the function
returns error - because this mostly it will be clever to use error
trapping.
=IF(ISERROR(VLOOKUP(...)),"",VLOOKUP(...))


Arvi Laanemets
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top