# Why doesn't my vlookup formula work?

**URL:** <https://boards.straightdope.com/t/why-doesnt-my-vlookup-formula-work/482695>\
**Category:** Factual Questions\
**Created:** [January 23, 2009, 7:53pm UTC](https://boards.straightdope.com/t/why-doesnt-my-vlookup-formula-work/482695 "2009-01-23T19:53:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Carol\_the\_Impaler](https://avatars.discourse-cdn.com/v4/letter/c/6a8cbe/32.png) [@Carol\_the\_Impaler](https://boards.straightdope.com/u/Carol_the_Impaler)\
**Post date:** [January 23, 2009, 7:53pm UTC](https://boards.straightdope.com/t/why-doesnt-my-vlookup-formula-work/482695/1 "2009-01-23T19:53:16Z")

</div>

I am trying to create a vlookup formula in Excel, and it only sorta works. I’ve created a table that calculates readership of a newspaper ad based on the size of the ad. Then I created two pull-down lists using the different ad sizes as the source data. What I want to do is to be able to choose “if you go from this ad size _x_ to this ad size _y_ you lose this many readers _z_.”

So, I was wanting to create two vlookup formulas, the first to return the beginning readership, and the second returning the smaller ad readership so I could then create a third formula to subtract the second from the first and return the number of readers lost.

So, first I created the table, which looks like this:

FulL 2,700  
Three 2,100  
Half 1,500  
Quarter 1,500  
Eighth 1,350

(The readership numbers themselves are a result of a formula.)

Then I created the two cells with the pull-down lists.

BUT when I create the vlookup formula, it correctly returns the readership number of the pull-down option is set to Full, Half, or Quarter. It returns the Eighth number if set to Three and returns !NA# if set to Eighth.

???

Here’s what I’ve done to try to fix this:

[ul]  
[li]Set the ad-size fields to general. Didn’t help.[/li][li]Set the ad-size fields to text. Didn’t help.[/li][li]Used Three Quarter instead of Three. Didn’t help.[/li][li]Used text of 3/4, 1/2, etc. Same result.[/li][li]Used the symbols for 3/4, 1/2, etc. Same result.[/li][li]Made sure there were no spaces before any of the words. Didn’t help.[/li][li]Made sure all of the ad-size fields were set to left justified. Well, you can guess the result.[/li][li]Deleted my spreadsheet. Went home and slept. Came back in the morning and created another from scratch. Same results. [/li][/ul]

No matter what I do, I get the correct result for Full, Half, and Quarter. The Eighth number for Three and an error for Eighth.

The pull down list is D18, the table is C12:D16, so the formula looks like this:

=VLOOKUP($D$18,C12:D16,2)

The hell???

(Also, if you could tell me how to keep the title of my thread from showing up in my OP, I’d love you for ever and ever.)

---

<div class="post-metadata">

**Author:** ![Carol\_the\_Impaler](https://avatars.discourse-cdn.com/v4/letter/c/6a8cbe/32.png) [@Carol\_the\_Impaler](https://boards.straightdope.com/u/Carol_the_Impaler)\
**Post date:** [January 23, 2009, 8:01pm UTC](https://boards.straightdope.com/t/why-doesnt-my-vlookup-formula-work/482695/2 "2009-01-23T20:01:42Z")

</div>

Of course the smilies are supposed to be colons. Damn my CEO for calling right when I’m trying to edit!!!

Cuz, if I meant to put smilies in my formula, considering how befuzzled I am that I’m getting such weird results, it woulda been this one -\>:mad:

---

<div class="post-metadata">

**Author:** ![batsto](https://avatars.discourse-cdn.com/v4/letter/b/b2d939/32.png) [@batsto](https://boards.straightdope.com/u/batsto)\
**Post date:** [January 23, 2009, 8:21pm UTC](https://boards.straightdope.com/t/why-doesnt-my-vlookup-formula-work/482695/3 "2009-01-23T20:21:04Z")

</div>

I think I understand what you’re trying to do…but it worked for me when I replicated it. This is the only change I made:=VLOOKUP(D18,c12 : c16,2,0)

(in other words, after the 2, I added “, 0”. I’m not sure why, but that’s the way I learned to write a vlookup, and it worked when I tried it.

---

<div class="post-metadata">

**Author:** ![batsto](https://avatars.discourse-cdn.com/v4/letter/b/b2d939/32.png) [@batsto](https://boards.straightdope.com/u/batsto)\
**Post date:** [January 23, 2009, 8:24pm UTC](https://boards.straightdope.com/t/why-doesnt-my-vlookup-formula-work/482695/4 "2009-01-23T20:24:03Z")

</div>

(also, in the post above, I added spaces before and after the colon 'cause I don’t know how to make it not show up as a smiley)

---

<div class="post-metadata">

**Author:** ![gumpy3885](https://avatars.discourse-cdn.com/v4/letter/g/d9b06d/32.png) [@gumpy3885](https://boards.straightdope.com/u/gumpy3885)\
**Post date:** [January 23, 2009, 8:25pm UTC](https://boards.straightdope.com/t/why-doesnt-my-vlookup-formula-work/482695/5 "2009-01-23T20:25:15Z")

</div>

The last parameter tells the formula whether you are using an ordered list or not. It makes the lookup faster if it’s pre-sorted and it can stop searching when the lookup value is past the highest value in sort order.

So, since your list is not in sort order, you can either sort it or just add “FALSE” (or 0) as the last argument to the formula.

---

<div class="post-metadata">

**Author:** ![Carol\_the\_Impaler](https://avatars.discourse-cdn.com/v4/letter/c/6a8cbe/32.png) [@Carol\_the\_Impaler](https://boards.straightdope.com/u/Carol_the_Impaler)\
**Post date:** [January 23, 2009, 8:42pm UTC](https://boards.straightdope.com/t/why-doesnt-my-vlookup-formula-work/482695/6 "2009-01-23T20:42:03Z")

</div>

Excellent. I’ve learned something new today. It’s never mattered in the past, so I never used that last parameter. It will now be my default. Thanks **batsto** and **gumpy**.
