0% found this document useful (0 votes)
351 views13 pages

VLOOKUP Function

The document provides instructions on how to use the VLOOKUP function in Excel. VLOOKUP allows users to look up values from a table based on a lookup value and return a corresponding value from the same row. It requires the lookup value, a range containing the table of data, the column number of the return value, and a logical value to specify an exact or approximate match. Examples are provided to demonstrate how to look up employee information like names and phone numbers based on their employee ID. Common issues are also discussed, such as ensuring the lookup range is sorted if looking for approximate matches.

Uploaded by

ruben diwas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
351 views13 pages

VLOOKUP Function

The document provides instructions on how to use the VLOOKUP function in Excel. VLOOKUP allows users to look up values from a table based on a lookup value and return a corresponding value from the same row. It requires the lookup value, a range containing the table of data, the column number of the return value, and a logical value to specify an exact or approximate match. Examples are provided to demonstrate how to look up employee information like names and phone numbers based on their employee ID. Common issues are also discussed, such as ensuring the lookup range is sorted if looking for approximate matches.

Uploaded by

ruben diwas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

VLOOKUP function

Use VLOOKUP, one of the lookup and reference functions, when you need to find things in a table or a range
by row. For example, look up an employee's last name by her employee number, or find her phone number by
looking up her last name (just like a telephone book).
The secret to VLOOKUP is to organize your data so that the value you look up (employees last name) is to the
left of the return value you want to find (employees phone number).

Syntax
VLOOKUP (lookup_value, table_array, col_index_num, [range_lookup])
For example:

=VLOOKUP(105,A2:C7,2,TRUE)

=VLOOKUP("Fontana",B2:E7,2,FALSE)

Argument name

Description

lookup_value

The value you want to look up. The value you want to look up must be in the first column of
the range of cells you specify in table-array .

(required)

For example, if table-array spans cells B2:D7, then your lookup_value must be in column B.
See the graphic below. Lookup_value can be a value or a reference to a cell.

table_array

(required)

The range of cells in which the VLOOKUP will search for the lookup_value and the return
value.
The first column in the cell range must contain the lookup_value (for example, Last Name in
the picture below.) The cell range also needs to include the return value (for example, First
Name in the graphic below) you want to find.

Argument name

Description

Learn how to select ranges in a worksheet.

col_index_num
(required)

The column number (starting with 1 for the left-most column of table-array) that contains the
return value.

range_lookup (optional)

A logical value that specifies whether you want VLOOKUP to find an exact match or an
approximate match:
TRUE assumes the first column in the table is sorted either numerically or
alphabetically, and will then search for the closest value. This is the default method if you don't
specify one.
FALSE searches for the exact value in the first column.

The following picture shows how you'd set up your worksheet with =VLOOKUP("Akers",B2:D5,2,FALSE) to
returnKim.

Examples
To use these examples in Excel, copy the data in the table below, and paste it in cell A1 of a new worksheet.

ID

Last name

First
name

Title

Birth
date

101

Davis

Sara

Sale
s
Rep.

12/8/196
8

102

Fontana

Olivier

V.P.
of
Sale
s

2/19/195
2

103

Leal

Karina

Sale
s
Rep.

8/30/196
3

104

Patten

Michae
l

Sale
s
Rep.

9/19/195
8

105

Burke

Brian

Sale
s
Mgr.

3/4/1955

106

Sousa

Luis

Sale
s

7/2/1963

Rep.

Formula

Description

=VLOOKUP("Fontana",B2:E7,2,FALSE)

Looks for the


valueFontana in the first
column (column B)
oftable_array B2:E7 and
returns the valueOlivier found
in the second column (Column
C) of thetable_array.
Therange_lookup FALSE
returns an exact match.

=VLOOKUP(102,A2:C7,2,FALSE)

Searches for an exact match of


the last name
for lookup_value102in
column A. Fontanais
returned.
Iflookup_value is 105,Burke i
s returned.

=IF(VLOOKUP(103,A1:E7,2,FALSE)="Sousa","Located","
Not found")

Checks to see if the last name


of Employee with
ID 103 is Sousa. Because 103
is actuallyLeal, the result
is Not found. If you change
"Sousa" to "Leal" in the
formula, the result is Located.

=INT(YEARFRAC(DATE(2014,6,30),
VLOOKUP(105,A2:E7,5, FALSE), 1))

For the fiscal year2014, finds


the age of the employee with
ID105. Uses theYEARFRAC
function to subtract the birth

date from the fiscal year end


date and displays the
result 59 as an integer using
the INT function.

=IF(ISNA(VLOOKUP(105,A2:E7,2,FALSE)) = TRUE,
"Employee not found", VLOOKUP(105,A2:E7,2,FALSE))

If there is an employee with


ID 105, displays the
employee's last name, which
is Burke. Otherwise, displays
the message Employee not
found. The ISNA function
(see IS functions) returns a
TRUE value when the
VLOOKUP function returns
the #N/A error value.

=VLOOKUP(104,A2:E7,3,FALSE) & " " &


VLOOKUP(104,A2:E7,2,FALSE) & " is a " &
VLOOKUP(104,A2:E7,4,FALSE)

For the employee with


ID 104, concatenates(combine
s) the values of three cells into
the complete sentenceMichael
Patten is a Sales Rep.

Common Problems
Problem

What went wrong

Wrong value
returned

If range_lookup is TRUE or left out, the first column needs to be sorted alphabetically or numerically. If the
first column isn't sorted, the return value might be something you don't expect. Either sort the first column,
or use FALSE for an exact match.

#N/A in cell

If range_lookup is TRUE, then if the value in the lookup_value is smaller than the smallest value in

Problem

What went wrong

the first column of the table_array, you'll get the #N/A error value.
If range_lookup is FALSE, the #N/A error value indicates that the exact number isn't found.
Learn more about errors in worksheets, like #N/A, #REF, and the rest.

#REF! in cell

If col_index_num is greater than the number of columns in table-array, you'll get the #REF! error value.

#VALUE! in
cell

If the table_array is less than 1, you'll get the #VALUE! error value.

#NAME? in
cell

The #NAME? error value usually means that the formula is missing quotes. To look up a person's name,
make sure you use quotes around the name in the formula. For example, enter the name as"Fontana" in
=VLOOKUP("Fontana",B2:E7,2,FALSE).

Best practices
Do this

Why

Use absolute
references
forrange_lookup

Using absolute references allows you to fill-down a formula so that it always looks at the same
exact lookup range.
Learn how to use absolute cell references.

Don't store number or


date values as text.

When searching number or date values, be sure the data in the first column of table_array isn't
stored as text values. Otherwise, VLOOKUP might return an incorrect or unexpected value.

Do this

Why

Sort the first column

Sort the first column of the table_array before using VLOOKUP when range_lookup is TRUE.

Use wildcard
characters

If range_lookup is FALSE and lookup_value is text, you can use the wildcard charactersthe
question mark (?) and asterisk (*)in lookup_value. A question mark matches any single
character. An asterisk matches any sequence of characters. If you want to find an actual question
mark or asterisk, type a tilde (~) in front of the character.
For example, =VLOOKUP("Fontan?",B2:E7,2,FALSE) will search for all instances
of Fontana with a last letter that could vary.

Make sure your data


doesn't contain
erroneous characters.

When searching text values in the first column, make sure the data in the first column doesn't have
leading spaces, trailing spaces, inconsistent use of straight ( ' or " ) and curly ( or ) quotation
marks, or nonprinting characters. In these cases, VLOOKUP might return an unexpected value.
To get accurate results, try using the CLEAN function or the TRIM function to remove trailing
spaces after table values in a cell.

Related

View Quick Reference Card: VLOOKUP refresher for a refresher on best ways to use VLOOKUP to
look up data in tables.

Learn how to create or change a cell reference.

Learn how to sort data in a table alphabetically or numerically.

VLOOKUP is a member of the lookup and reference functions, which includes the HLOOKUP
function.

Use the CLEAN function or the TRIM function to remove leading spaces in table values.

Learn more about errors in worksheets, like #N/A, #REF, and the rest.

See a video on how to use the VLOOKUP function.

How to use Excel's VLOOKUP function


Many of our learners have told us they want to learn how to use Excel's
VLOOKUP function. VLOOKUP is an extremely useful tool, and learning
how to use it is easier than you think!
Before you start, you should understand the basics of functions. Check out
our Functions lesson from our Excel Formulas tutorial (or select
a specific version of Excel). VLOOKUP works the same in all
versions of Excel, and it even works in other spreadsheet applications like
Google Sheets. You can download the example if you'd like to work
along with this article.

What exactly is VLOOKUP?


Basically, VLOOKUP lets you search for specific information in your
spreadsheet. For example, if you have a list of products with prices, you
could search for the price of a specific item.
We're going to use VLOOKUP to find the price of the Photo frame. You can
probably already see that the price is $9.99, but that's because this is a
simple example. Once you learn how to use VLOOKUP, you'll be able to
use it with larger, more complex spreadsheets, and that's when it will
become truly useful.

We'll add our formula to cell E2, but you can add it to any blank cell. As with
any formula, you'll start with an equals sign (=). Then type the formula
name. Our arguments will need to be in parentheses, so type an open
parenthesis. So far, it should look like this:
=VLOOKUP(

Adding the arguments


Now, we'll add our arguments. The arguments will tell VLOOKUP what to
search for and where to search.
The first argument is the name of the item you're searching for, which in
this case is Photo frame. Because the argument is text, we'll need to put it
in double quotes:
=VLOOKUP("Photo frame"
The second argument is the cell range that contains the data. In this
example, our data is in A2:B16. As with any function, you'll need to use a
comma to separate each argument:

=VLOOKUP("Photo frame", A2:B16


Note: It's important to know that VLOOKUP will always search the first
column in this range. In this example, it will search column A for "Photo
frame". In some cases, you may need to move the columns around so the
first column contains the correct data.
The third argument is the column index number. It's simpler than it
sounds: The first column in the range is 1, the second column is 2, etc. In
this case, we are trying to find the price of the item, and the prices are
contained in thesecond column. This means our third argument will be 2:
=VLOOKUP("Photo frame", A2:B16, 2
The fourth argument tells VLOOKUP whether to look for approximate
matches, and it can be either TRUE or FALSE. If it is TRUE, it will look for
approximate matches. Generally, this is only useful if the first column has
numerical values that have been sorted. Because we're only looking for
exact matches, the fourth argument should be FALSE. This is our last
argument, so go ahead and close the parentheses:
=VLOOKUP("Photo frame", A2:B16, 2, FALSE)
That's it! When you press Enter, it should give you the answer, which
is 9.99.

How it works
Let's take a look at how this formula works. It first searches
vertically down the first column (VLOOKUP is short forvertical lookup).

When it finds "Photo frame", it moves to the second column to find the
price.

If we want to find the price of a different item, we can just change the first
argument:
=VLOOKUP("T-shirt", A2:B16, 2, FALSE)
or:
=VLOOKUP("Gift basket", A2:B16, 2, FALSE)

Another example
Are you ready for a slightly more complicated example? Let's say we have
a third column that has the category for each item. This time, instead of
finding the price we'll find the category.

To find the category, we'll need to change the second and third
arguments in our formula. First, we'll change the range to A2:C16 so it
includes the third column. Next, we'll change the column index number
to 3 because our categories are in the third column:
=VLOOKUP("Gift basket", A2:C16, 3, FALSE)
When you press Enter, you'll see that the Gift basket is in
the Gifts category.

If you'd like more practice, see if you can find the following:
The price of the coffee mug
The category of the landscape painting
The price of the serving bowl

The category of the scarf


Now you know the basics of using VLOOKUP. Although advanced users
sometimes use VLOOKUP in different ways, you can do a lot with the
techniques we've covered. For example, if you have a contact list you could
search for someone's name to find his or her phone number. If your contact
list has columns for the email address or company name, you could search
for those by simply changing the second and third arguments, as we did in
our example. The possibilities are endless!

You might also like