Professional Documents
Culture Documents
https://www.vertex42.com/blog/excel-formulas/vlookup-and-index-match-examples.html
This workbook contains examples from the article "VLOOKUP and INDEX-MATCH Examples in Excel." Regar
sharing, think of this file like a book. You may use the ideas and techniques and formulas explained here, but y
reproduce this worksheet or copy substantial portions from it, just as you would not do so with a book. Thank y
EXAMPLES
VLOOKUP Syntax
NOTES If you insert a column into the table, the hard-coded "3" may no longer point to the correct colu
from happening, use (COLUMN(result_column)-COLUMN(lookup_column)+1) in place of the 3
INDEX-MATCH Syntax
NOTE For an exact match, the last argument in the VLOOKUP and MATCH functions should be FAL
Actually, the lookup is not truly "exact" because VLOOKUP and MATCH are not case-sensitive
the option an "exact match" so we'll go with that and explain how to do a case-sensitive match
NOTES Remember to use FALSE or 0 for exact matches, because both VLOOKUP and MATCH defau
or 1.
As a general rule, use absolute ($A$1) cell references to refer to the lookup ranges, table arra
when you copy the lookup formula you will usually want those ranges to not change.
Check for extra blank spaces if you think a lookup formula should be finding a match, but it is
as text may result in a match error, also.
Use IFERROR to handle the error returned when an exact match is not found.
Step 1: MATCH returns the position number of the matched value within th
Syntax: =MATCH(lookup_value,lookup_range,[match_type])
Example: =MATCH("MT",{"CA","NV","MT","TX","NY"},0)
NOTE The lookup_range can be a row or column, but if lookup_range is more than one row or colum
an error.
The match_type is optional, but the default is not 0. So, it is is best to always specify the matc
Step 2: INDEX returns the value from an array based on the row and colum
Syntax: =INDEX(array,row_number,[column_number],[area_number])
NOTES You don't need to include the column_number if the array is a single column.
Formula: =INDEX(array,row_number)
Formula: =INDEX(array,row_number,column_number)
In this example, we are looking for the first occurrence of a text string ending with "200"
In this example, we are looking for the first product that starts with an "A" and has "C" as the 3
In this example, we are looking for the first occurrence of any product name containing a ques
Formula: =VLOOKUP(lookup_value,table_array,result_column_num,TRUE)
Formula: =INDEX(result_range,MATCH(lookup_value,lookup_range,1)
0% F 93% A
60% D 70% C
70% C 75% C
80% B 83% B
90% A
0 0% 100 2%
10 1% 5 0%
100 2% 125 2%
1000 5% 2500 5%
Example 4: Experiment with what happens when the data is not sorted.
0 0% 200 5%
150 1%
300 2%
0 3%
0 4%
50 5%
500 6%
0 7%
1000 8%
NOTE For these types of matches, the formulas use an efficient search algorithm that assumes the d
ascending order. That is why the above example returns 5% instead of 1% (a sequential chec
first cell) or 7% (a sequential check starting with the last cell). The algorithm looks at the first a
looks at the middle value (which is zero) and decides to limit its search to the last 5 rows, then
500 and decides to limit the search to rows 5-7, etc.
Formula: =VLOOKUP(row_lookup_value,table_array,
MATCH(column_lookup_value,column_label_range,0), FALSE)
Formula: =HLOOKUP(column_lookup_value,table_array,
MATCH(row_lookup_value,row_label_range,0), FALSE)
Syntax: =INDEX(array,row_number,column_number,area_number)
You can also do 3D lookups using VLOOKUP. Starting with the 2D lookup formula, we just need a formula to r
table_array argument. In this example we'll use the CHOOSE function and define the syntax for this example b
MATCH to return the table_number based on the chosen value of "Road" or "Plane".
CHOOSE: =CHOOSE(table_number,table_array_1,table_array_2,...)
Formula: =INDEX(result_range,MATCH(value1&value2,lookup_col1&lookup_col2,0))
Helper Product Color Price Qty
Ablue A blue 34.50 34
Agreen A green 52.30 28 Lookup Value:
Bblue B blue 29.30 57
Bgreen B green 87.20 103
Byellow B yellow 98.10 23 INDEX-MATCH:
Amount Balance
300.00 300.00 VLOOKUP 60
(240.00) 60.00
text INDEX-MATCH 60
#N/A LOOKUP 60
Text
alpha VLOOKUP Ω
to
Ω INDEX-MATCH Ω
5000
#N/A LOOKUP Ω
Note: Using MATCH("*",lookup_column,-1) won't always find the last text value. Text beginning with symbols l
leading space will make that formula not find the last text value.
A more concise formula uses the LOOKUP function. The LOOKUP function allows the lookup_range to be an e
than a direct reference (and it can be a row or column). We can use a logical comparison and search for the la
this:
The trick here is that the expression 1/NOT(ISBLANK(lookup_range)) returns an array of 1s for TRUE and #DI
LOOKUP ignores the error values so it will return the last value in lookup_range that is not blank. The number
needs to be larger than 1 to return the last non-blank value in the range.
Text
1 LOOKUP 32
#N/A
32 INDEX-MATCH 32
You can use the SMALL function to return the nth smallest value from an array, and we can use that along with
and the INDEX function to do a lookup based on the nth match. See the above reference to learn more about A
specifically the SMALL-IF formula.
Event Date
A 3/7/2018 DATE 3/7/2018
B 3/8/2018 OCCURRENCE 2
C 3/7/2018
D 3/7/2018 EVENT C
E 3/10/2018
Return the 2nd Event occurring on the date 3/7/2018. The { } brackets in the formula below are a reminder
Ctrl+Shift+Enter to enter the formula as an Array Formula. You don't actually type the brackets into the formula
Formula: { =INDEX(result_range,SMALL(IF(lookup_range=lookup_value,
ROW(lookup_range)-ROW(first_cell_in_lookup_range)+1),occurrence)) }
REFERENCES
OOKUP Example
Result
29.30
EX-MATCH Example
Result
29.30
a single column.
$ 20.00 $ 20.00
$ 30.00 $ 30.00
$ 40.00 $ 40.00
aracter.
P and INDEX-MATCH
return values that are not necessarily exact matches.
4th argument = TRUE) and a "Less than" match with
ed in ascending order.
Examples
INDEX-MATCH
A
C
C
B
Examples
INDEX-MATCH
2%
0%
2%
5%
Examples
INDEX-MATCH
15%
10%
0%
Examples
INDEX-MATCH
5%
arch algorithm that assumes the data is sorted in
instead of 1% (a sequential check starting with the
). The algorithm looks at the first and last value, then
its search to the last 5 rows, then looks at the value
UP and INDEX-MATCH-MATCH
y the same as the simple lookup formula, except that in
CH function and in the INDEX formula we replace the
se-Sensitive Lookup
Result
20.00
40.00
Match Criteria
sults from the lookup columns. Using VLOOKUP
INDEX-MATCH does not need the helper column, but
m, FALSE)
lookup_col2,0))
Product: A
Color: green
Lookup Value: Agreen
VLOOKUP: 52.3
INDEX-MATCH: 52.3 Array Formula: Remember to press Ctrl+Shift+Enter
INDEX-MATCH
up, a simple method is to use INDEX-MATCH and
e of TRUE. Using this method, you can have any
+Shift+Enter).
ue1) *
1) )
e)
the previous example, we use a "large" text value. By
phabetical order. If you are using the English alphabet
characters or symbols in your list, you could try a
1), MATCH(9E+100,
ange)
Ctrl+Shift+Enter
lue,
ccurrence)) }
VLOOKUP and INDEX-MATCH Examples
By Vertex42.com
https://www.vertex42.com/blog/excel-formulas/vlookup-and-index-match-examples.html
Please review the following license agreement to learn how you may or
may not use this file. Thank you.
https://www.vertex42.com/licensing/EULA_privateuse.html