A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

) Vlookup help please!



 
 
Thread Tools Display Modes
  #1  
Old October 4th, 2003, 10:13 AM
Ken Wright
external usenet poster
 
Posts: n/a
Default ) Vlookup help please!

It's easy to get lost in a formula if you don't really understand what the formula is actually
doing:-

The VLOOKUP function essentially takes a value that you specify, whether it be a hardcoded
number/letter/text or a value within a cell reference, and then goes and looks it up in a table.
It will look for that value in the leftmost column of the table, and either find it or the closest
match, and will then return the corresponding value on the same row, in whatever column of that
table that you tell it to:-

Example - With the following table

D E
1 1 0.20
2 10 0.25
3 20 0.30
4 30 0.35
5 40 0.40

and with your value that you are looking up in say cell A1 (and let's assume it is 25 for
example).

You can put a formula in pretty much any other cell, that says, take the value in cell A1 (25), go
and look for it in the lefthand column of the table (D15), and then when you have found it (or
the lowest closest number to it), go to the second column (or whichever one you specify if there
are more than 2) and give me the number that it is on the same row in that column.

So, with the formula being =VLOOKUP(A1,D1:E5,2) it will first take the value in A1 which is 25,
then go look for it in the leftmost column (D) of your specified table (D1:E5), and it will try to
find that number. Now it isn't there, so what it will do is look for the next lower closest
number, which in this case will be 20, and the 2 in the formula says to go and get the value in
the 2nd column (E) in your table, that is on the same row as the 20. That value in this case is
0.3

If you put the value 30 or 31 or 32 etc into A1 now, you will see the result of the formula
change, because now it will either find those numbers or the lower closest number (and in each
case there it is 30), and will subsequently return 0.35 as the corresponding value.

Just to show you how the 2 really works in that formula, if you added one more column to your
table so that it looked like this:-

D E F
1 1 0.20 0.15
2 10 0.25 0.25
3 20 0.30 0.35
4 30 0.35 0.45
5 40 0.40 0.55

and you actually wanted the value from Col F, then you would simpl;y change the 2 in the formula
to a 3 to signify the third column, eg:-

=VLOOKUP(A1,D1:E5,3)

With the examples already given, 25 in A1 would return 0.35, and 30/31/32 would return 0.45

The one caveat to all of this (When getting the nearest number is OK) is that the data in your
leftmost column must be sorted in ascending order.


There are times when you would only want it to give you a value if you had an exact match on the
number, and in this instance you would simply add a 4th argument of 0 or FALSE to the formula,
eg:-

=VLOOKUP(A1,D1:E5,3,0)

or

=VLOOKUP(A1,D1:E5,3,FALSE)

In these cases you do not need to have the data in your leftmost column sorted.

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL2K & XLXP

----------------------------------------------------------------------------
Attitude - A little thing that makes a BIG difference
----------------------------------------------------------------------------



"niles" wrote in message
...
I am trying to do a vlookup function. I don't understand what's wrong
with my formula. I am in an Excel class and the book doesn't explain
how to come up with the formula. Here's my info on the worksheet:

A15:B19 is a table with a range of sales and rate of commission.
Column A is the range of sales and column B is the rate of commission.


C4:C11 has the gross sales.

I am in D4 trying to come up with the employee's commission percent.

Here is my formula:
=VLOOKUP(D4,A15:B19,2)

What am I doing wrong in the formula? I suspect that it is something
with D4 in the formula.

Did this post make any sense? Thanks for your help.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.522 / Virus Database: 320 - Release Date: 29/09/2003


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:51 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.