Loading
Excel.Tips.Net ExcelTips (Menu Interface)

Understanding the VLOOKUP Function

Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Understanding the VLOOKUP Function.

Excel has a huge number of different worksheet functions—some of them used quite often, and others quite obscure. One of the more obscure functions (at least for Excel novices) is the VLOOKUP function. Understanding how this function works can make your life much simpler, especially when dealing with tables of data and pulling information from those tables.

VLOOKUP is a shortened form of "Vertical Lookup." It is a function that looks vertically (up and down) through a data table and extracts information from the table as you direct. For instance, let's assume you have a data table that lists part numbers and their prices. The part numbers are in column H, and the prices for those parts are in column I. (Assume the data table is in the range H5:I27.) You can use the following formula to look up a part number (located in cell C28) and return its price:

=VLOOKUP(C28,H5:I27,2)

Notice that, at a minimum, VLOOKUP requires three arguments. The first is the value that you want to look up. In this case, C28 contains the part number to be matched in the data table. The second argument is the actual data table, in this case H5:I27. The third argument specifies from which column of the table the value should be returned. In this case I wanted the price, which was in the second column (column I) of the data table.

What VLOOKUP does, in this instance, is to take the value in C28 and then try to match it to a cell in the first column of the range H5:127. If it finds a match, then it returns the value from column 2 of that range—the price we wanted.

VLOOKUP will also accept an optional fourth argument, which can be either TRUE or FALSE. The default value for the argument is TRUE, which means that VLOOKUP will approximate values when matching them in the data table. If an exact match cannot be found in the data table, then VLOOKUP considers the next lowest value in the first column of the table to be a match. Thus, if you are looking for a part number such as "P23," and there is no such part number in the table, but there is a "P22," then VLOOKUP considers that a match. If you set the optional fourth argument to FALSE, then VLOOKUP only returns successfully if it can make an exact match.

Because of the way in which VLOOKUP does its matching, it is very important that the information in your data table be sorted in ascending order according to the values in the first column.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2610) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Understanding the VLOOKUP Function.

Related Tips:

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

 

Comments for this tip:

Michael (micky) Avidan    13 Jul 2013, 13:08
@GhostsOfCanton

I could not find any special issue/problen - as per your example - in using VLOOKUP or: INDEX+MATCH.

http://tinypic.com/r/63vx2g/5

Michael Avidan
“Microsoft®” MVP – Excel
ISRAEL




GhostsOfCanton    12 Jul 2013, 14:20
I can't proclaim to truly know ... but I believe it is because VLOOKUP uses a "top-down" process of looking for your reference value. If it isn't there, it abandons the effort.

For example, if your 1st column is has rows with 1, 2, 3, 6, 4, 5 ...

and you want the value in the cell to the right of cell that contains "4" ... the process starts in the left-most column and reads ... 1 ... (skip) ... 2 ... (skip) ... 3 ... (skip) ... 6 ... value larger than 4 ... (stop)

depending on what you're wanting to do, vlookup may not be for you.

I find most people asking about vlookup, really just need SUMIFS
Prafulla Shukla    15 Mar 2013, 08:33
Hi,

Can you please explain why the first column mush be sorted in ascending order before using VLOOKUP?

All it says here about this is "Because of the way in which VLOOKUP does its matching" and that's why we need to do it.

Thanks.
Prafulla Shukla    15 Mar 2013, 08:30
Can you please explain why does the key column or the first column mush be sorted in ascending manner for VLOOKUP?

All it says here is "Because of the way in which VLOOKUP does its matching" we have to do so.

Thanks.

Leave your own comment:

*Name:
Email:
  Notify me about new comments ONLY FOR THIS TIP
Notify me about new comments ANYWHERE ON THIS SITE
Hide my email address
*Text:
*What is 4+5 (To prevent automated submissions and spam.)
 
          Commenting Terms
 
 

Our Company

Sharon Parq Associates, Inc.

About Tips.Net

Contact Us

 

Advertise with Us

Our Privacy Policy

Our Sites

Tips.Net

Beauty and Style

Cars

Cleaning

Cooking

DriveTips (Google Drive)

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2013)

Gardening

Health

Home Improvement

Money and Finances

Organizing

Pests and Bugs

Pets and Animals

WindowsTips (Microsoft Windows)

WordTips (Word 97–2003)

WordTips (Word 2007–2013)

Our Products

Premium Newsletters

Helpful E-books

Newsletter Archives

 

Excel Products

Word Products

Our Authors

Author Index

Write for Tips.Net

Copyright © 2014 Sharon Parq Associates, Inc.