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.

Understanding the VLOOKUP Function

Written by Allen Wyatt (last updated August 3, 2020)
This tip applies to Excel 97, 2000, 2002, and 2003


3

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.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Finding Unknown Links

There are several things to try when finding unknown links in Excel.

Discover More

Writing a Macro from Scratch

Recording macros is a great approach to getting started with macros, but at some point you'll need to create one from ...

Discover More

Changing Paragraph Borders

Word allows you to easily add borders to a paragraph of text. If you want, you can even change each side of the border to ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (menu)

Using the COLUMN Function

Need to know the column number for use in a formula? The worksheet function you want is the COLUMN function, described in ...

Discover More

Using VLOOKUP to Access Information to the Left

One of the most useful function in Excel is VLOOKUP. One thing it won't do, however, is allow you to lookup information ...

Discover More

Determining a State from an Area Code

Want to be able to take information that is in one cell and match it to data that is contained in a table within a ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 1 + 1?

2017-05-16 10:24:48

Hiba

I need to copy the data from master sheet (main sheet) column B (first name) to paste in another tab (same excel file), but I want that data of last name, contact # and email automatically paste from master sheet


2016-01-16 16:51:01

Dave Onorato

For the optional 4th argument, I'm using "false" for exact match only 99.9% of the time. So a zero can be used.
Next, since the vlookup formula will probably be copied, it makes sense to use absolute reference for the table, $H$5:$I$27.
I suggest putting all lookup tables in a separate sheet and using range names, like PartList. Much easier to remember. And if you add new parts, you change the definition of the range name once, all formulas now use the newly defined rangename.
So the formula could be...
=VLOOKUP(C28,PartList,2,0)


2016-01-16 13:03:29

Dennis Taylor

The statement "...it is very important that the information in your data table be sorted in ascending order according to the values in the first column" is not accurate when it comes to exact matches. For exact matches, the left column of the table can be in any order and often it makes sense for the table data to be sorted based on data in another column of the table.


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.