Solved

Excel vlookup problem

Posted on 2012-03-17
4
185 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
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 demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

737 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