VLOOKUP Function: Description
VLOOKUP Function: Description
VLOOKUP function
Show All
Tags commands; find; formula; functions; lookup; reference; search; troubleshoot; vlookup
This article describes the formula syntax and usage of the VLOOKUP function in Microsoft Office Excel.
Description
You can use the VLOOKUP function to search the first column of a range of cells, and then return a value from any
cell on the same row of the range. For example, suppose that you have a list of employees contained in the range
A2:C10. The employees' ID numbers are stored in the first column of the range, as shown in the following illustration.
If you know the employee's ID number, you can use the VLOOKUP function to return either the department or the
name of that employee. To obtain the name of employee number 38, you can use the formula =VLOOKUP(38,
A2:C10, 3, FALSE). This formula searches for the value 38 in the first column of the range A2:C10, and then returns
the value that is contained in the third column of the range and on the same row as the lookup value ("Axel
Delgado").
The V in VLOOKUP stands for vertical. Use VLOOKUP instead of HLOOKUP when your comparison values are
located in a column to the left of the data that you want to find.
Syntax
VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
The VLOOKUP function syntax has the following arguments:
lookup_value Required. The value to search in the first column of the table or range. The
lookup_value argument can be a value or a reference. If the value you supply for the lookup_value
argument is smaller than the smallest value in the first column of the table_array argument, VLOOKUP
returns the #N/A error value.
table_array Required. The range of cells that contains the data. You can use a reference to a range
(for example, A2:D8), or a range name. The values in the first column of table_array are the values
searched by lookup_value. These values can be text, numbers, or logical values. Uppercase and
lowercase text are equivalent.
col_index_num Required. The column number in the table_array argument from which the matching
value must be returned. A col_index_num argument of 1 returns the value in the first column in
table_array; a col_index_num of 2 returns the value in the second column in table_array, and so on.
Greater than the number of columns in table_array, VLOOKUP returns the #REF! error
value.
range_lookup Optional. A logical value that specifies whether you want VLOOKUP to find an exact
match or an approximate match:
If range_lookup is either TRUE or is omitted, an exact or approximate match is returned. If
an exact match is not found, the next largest value that is less than lookup_value is
returned.
IMPORTANT
table_array must be placed in ascending sort order; otherwise, VLOOKUP might not return the
correct value.
If range_lookup is FALSE, the values in the first column of table_array do not need to be sorted.
If the range_lookup argument is FALSE, VLOOKUP will find only an exact match. If there
are two or more values in the first column of table_array that match the lookup_value, the
first value found is used. If an exact match is not found, the error value #N/A is returned.
Example 1
The example may be easier to understand if you copy it to a blank worksheet.
How do I copy an example?
1.
IMPORTANT
2.
Press CTRL+C.
3.
4.
IMPORTANT
5.
For the example to work properly, you must paste it into cell A1 of the worksheet.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+`
(grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas
button.
This example searches the Density column of an atmospheric properties table to find corresponding values in the
Viscosity and Temperature columns. (The values are for air at 0 degrees Celsius at sea level, or 1 atmosphere.)
Density
Viscosity
Temperatu
re
0.457
3.55
500
0.525
3.25
400
0.606
2.93
300
0.675
2.75
250
0.746
2.57
200
0.835
2.38
150
0.946
2.17
100
1.09
1.95
50
1.29
1.71
Formula
Description
Result
2
3
4
5
6
7
8
9
10
11
12
13
14
=VLOOKUP(1,A2:C10,2)
2.17
=VLOOKUP(1,A2:C10,3,TRU
E)
100
=VLOOKUP(0.7,A2:C10,3,FA
LSE)
#N/A
=VLOOKUP(0.1,A2:C10,2,TR
UE)
#N/A
=VLOOKUP(2,A2:C10,2,TRU
E)
1.71
15
16
Example 2
The example may be easier to understand if you copy it to a blank worksheet.
How do I copy an example?
1.
IMPORTANT
2.
Press CTRL+C.
3.
4.
IMPORTANT
5.
For the example to work properly, you must paste it into cell A1 of the worksheet.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+`
(grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas
button.
This example searches the Item-ID column of a baby products table and matches values in the Cost and Markup
columns to calculate prices and test conditions.
Item-ID
Item
Cost
Markup
ST-340
Stroller
$145.67
30%
BI-567
Bib
$3.56
40%
DI-328
Diapers
$21.45
35%
WI-989
Wipes
$5.12
40%
AS-469
Aspirator
$2.56
45%
Formula
Description
Result
$28.96
$5.73
Markup
is 30%
Cost is
$3.56
10
11
Example 3
The example may be easier to understand if you copy it to a blank worksheet.
How do I copy an example?
1.
IMPORTANT
2.
Press CTRL+C.
3.
4.
IMPORTANT
5.
For the example to work properly, you must paste it into cell A1 of the worksheet.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+`
(grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas
button.
This example searches the ID column of an employee table and matches values in other columns to calculate ages
and test for error conditions.
ID
Last name
First
name
Title
Birth
date
Davis
Sara
Sales
Rep.
12/8/1968
Fontana
Olivier
V.P. of
Sales
2/19/1952
Leal
Karina
Sales
Rep.
8/30/1963
Patten
Michael
Sales
Rep.
9/19/1958
Burke
Brian
Sales
Mgr.
3/4/1955
Sousa
Luis
Sales
Rep.
7/2/1963
Formula
Description
Result
=INT(YEARFRAC(DATE(2004,6,30),
VLOOKUP(5,A2:E7,5, FALSE), 1))
49
=IF(ISNA(VLOOKUP(5,A2:E7,2,FALSE)) =
TRUE, "Employee not found",
VLOOKUP(5,A2:E7,2,FALSE))
Burke
7
8
Employee
not found
11
=VLOOKUP(4,A2:E7,3,FALSE) & " " &
VLOOKUP(4,A2:E7,2,FALSE) & " is a " &
VLOOKUP(4,A2:E7,4,FALSE)
12
Remarks
Michael
Patten is a
Sales Rep.
When searching text values in the first column of table_array, ensure that the data in the first column of
table_array does not contain leading spaces, trailing spaces, inconsistent use of straight ( ' or " ) and
curly ( or ) quotation marks, or nonprinting characters. In these cases, VLOOKUP might return an
incorrect or unexpected value.
When searching number or date values, ensure that the data in the first column of table_array is not
stored as text values. In this case, VLOOKUP might return an incorrect or unexpected value.
If range_lookup is FALSE and lookup_value is text, you can use the wildcard characters the
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 (~) preceding the character.
How can I lookup when match has more than one value?
How to look up a value?
How do I access data stored in a SQL server for vlookup function?
#N/A in VLookup - Can I use another function that will return 0?
VLOOKUP How do you keep the pathway linked to original source?
How do I remove the #div or N/A and make it 0 when using VLookup?
How do I use a vertical look up to adjust a graph format?
Can I turn the #N/A result from a lookup function to a zero?
See Also
DATE function
HLOOKUP function
INDEX function
INT function
IS functions
LOOKUP function
MATCH function
YEARFRAC function