Solved

Excel vlookup problem

Posted on 2012-03-17
4
181 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now