Solved

Excel vlookup problem

Posted on 2012-03-17
4
184 Views
Last Modified: 2012-03-18
In the attached spreadsheet, I cannot understand why it does what it does.  How can D1 - D10 be #N/A, but then D11 - D20 yield that result?  It all makes no sense, even in this cheesy-easy example.  I made this simple test case because in my big complicated spreadsheet it wasn't working either
Book3.xls
0
Comment
Question by:johnsonsite
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
ltsweb earned 500 total points
ID: 37733527
You should use: =VLOOKUP(A1|$B$1:$C$20|2|FALSE)

It populated the answer "T" instead of "N/A"

The reason is False will do an exact match which sounds counter intuitive, but it works!

Hope that helps!
0
 

Author Comment

by:johnsonsite
ID: 37733618
Yes, not intuitive. All the web searching I did (hours worth) never exposed that trick.  It really should work fine the other way too, with TRUE (the default).  Stupid Microsoft.

Anyway, thanks a lot!
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 37733703
Sometimes Excel help is the best place to look. My version says this about the final (4th) argument:

range_lookup    Optional. A logical value that specifies whether you want VLOOKUP to find an exact match or an approximate match:

If range_lookup is either TRUE or is omitted, an exact or approximate match is returned. If an exact match is not found, the next largest value that is less than lookup_value is returned.

Important   If range_lookup is either TRUE or is omitted, the values in the first column of table_array must be placed in ascending sort order; otherwise, VLOOKUP might not return the correct value.


Note that last part, TRUE will only work when the lookup array is sorted ascending - yours is sorted descending, hence #N/A results.

regards, barry
0
 

Author Comment

by:johnsonsite
ID: 37733838
Well, that was a bad example I sent out then. In my real spreadsheet the values are ascending. Either way, adding the FALSE parameter cured the problem, although it doesn't make sense.  If a match is an exact match, then it would ALSO satisfy being a partial match. The function just doesn't even work if the range_lookup is TRUE or omitted, it returns mostly garbage.

Thank you!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question