Vlookup with index in excel

Tip: Try using the new XLOOKUP and XMATCH functions, improved versions of the functions described in this article. These new functions work in any direction and return exact matches by default, making them easier and more convenient to use than their predecessors.

Suppose that you have a list of office location numbers, and you need to know which employees are in each office. The spreadsheet is huge, so you might think it is challenging task. It’s actually quite easy to do with a lookup function.

The VLOOKUP and HLOOKUP functions, together with INDEX and MATCH, are some of the most useful functions in Excel.

Note: The Lookup Wizard feature is no longer available in Excel.

Here’s an example of how to use VLOOKUP.

=VLOOKUP(B2,C2:E7,3,TRUE)

In this example, B2 is the first argument—an element of data that the function needs to work. For VLOOKUP, this first argument is the value that you want to find. This argument can be a cell reference, or a fixed value such as «smith» or 21,000. The second argument is the range of cells, C2-:E7, in which to search for the value you want to find. The third argument is the column in that range of cells that contains the value that you seek.

The fourth argument is optional. Enter either TRUE or FALSE. If you enter TRUE, or leave the argument blank, the function returns an approximate match of the value you specify in the first argument. If you enter FALSE, the function will match the value provide by the first argument. In other words, leaving the fourth argument blank—or entering TRUE—gives you more flexibility.

This example shows you how the function works. When you enter a value in cell B2 (the first argument), VLOOKUP searches the cells in the range C2:E7 (2nd argument) and returns the closest approximate match from the third column in the range, column E (3rd argument).

A typical use of the VLOOKUP function

The fourth argument is empty, so the function returns an approximate match. If it didn’t, you’d have to enter one of the values in columns C or D to get a result at all.

When you’re comfortable with VLOOKUP, the HLOOKUP function is equally easy to use. You enter the same arguments, but it searches in rows instead of columns.

Using INDEX and MATCH instead of VLOOKUP

There are certain limitations with using VLOOKUP—the VLOOKUP function can only look up a value from left to right. This means that the column containing the value you look up should always be located to the left of the column containing the return value. Now if your spreadsheet isn’t built this way, then do not use VLOOKUP. Use the combination of INDEX and MATCH functions instead.

This example shows a small list where the value we want to search on, Chicago, isn’t in the leftmost column. So, we can’t use VLOOKUP. Instead, we’ll use the MATCH function to find Chicago in the range B1:B11. It’s found in row 4. Then, INDEX uses that value as the lookup argument, and finds the population for Chicago in the 4th column (column D). The formula used is shown in cell A14.

Using INDEX and MATCH to look up a value

For more examples of using INDEX and MATCH instead of VLOOKUP, see the article https://www.mrexcel.com/excel-tips/excel-vlookup-index-match/ by Bill Jelen, Microsoft MVP.

Give it a try

If you want to experiment with lookup functions before you try them out with your own data, here’s some sample data.

VLOOKUP Example at work

Copy the following data into a blank spreadsheet.

Tip: Before you paste the data into Excel, set the column widths for columns A through C to 250 pixels, and click Wrap Text (Home tab, Alignment group).

Density

Viscosity

Temperature

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

0

Formula

Description

Result

=VLOOKUP(1,A2:C10,2)

Using an approximate match, searches for the value 1 in column A, finds the largest value less than or equal to 1 in column A which is 0.946, and then returns the value from column B in the same row.

2.17

=VLOOKUP(1,A2:C10,3,TRUE)

Using an approximate match, searches for the value 1 in column A, finds the largest value less than or equal to 1 in column A, which is 0.946, and then returns the value from column C in the same row.

100

=VLOOKUP(0.7,A2:C10,3,FALSE)

Using an exact match, searches for the value 0.7 in column A. Because there is no exact match in column A, an error is returned.

#N/A

=VLOOKUP(0.1,A2:C10,2,TRUE)

Using an approximate match, searches for the value 0.1 in column A. Because 0.1 is less than the smallest value in column A, an error is returned.

#N/A

=VLOOKUP(2,A2:C10,2,TRUE)

Using an approximate match, searches for the value 2 in column A, finds the largest value less than or equal to 2 in column A, which is 1.29, and then returns the value from column B in the same row.

1.71

HLOOKUP Example

Copy all the cells in this table and paste it into cell A1 on a blank worksheet in Excel.

Tip: Before you paste the data into Excel, set the column widths for columns A through C to 250 pixels, and click Wrap Text (Home tab, Alignment group).

Axles

Bearings

Bolts

4

4

9

5

7

10

6

8

11

Formula

Description

Result

=HLOOKUP(«Axles», A1:C4, 2, TRUE)

Looks up «Axles» in row 1, and returns the value from row 2 that’s in the same column (column A).

4

=HLOOKUP(«Bearings», A1:C4, 3, FALSE)

Looks up «Bearings» in row 1, and returns the value from row 3 that’s in the same column (column B).

7

=HLOOKUP(«B», A1:C4, 3, TRUE)

Looks up «B» in row 1, and returns the value from row 3 that’s in the same column. Because an exact match for «B» is not found, the largest value in row 1 that is less than «B» is used: «Axles,» in column A.

5

=HLOOKUP(«Bolts», A1:C4, 4)

Looks up «Bolts» in row 1, and returns the value from row 4 that’s in the same column (column C).

11

=HLOOKUP(3, {1,2,3;»a»,»b»,»c»;»d»,»e»,»f»}, 2, TRUE)

Looks up the number 3 in the three-row array constant, and returns the value from row 2 in the same (in this case, third) column. There are three rows of values in the array constant, each row separated by a semicolon (;). Because «c» is found in row 2 and in the same column as 3, «c» is returned.

c

INDEX and MATCH Examples

This last example employs the INDEX and MATCH functions together to return the earliest invoice number and its corresponding date for each of five cities. Because the date is returned as a number, we use the TEXT function to format it as a date. The INDEX function actually uses the result of the MATCH function as its argument. The combination of the INDEX and MATCH functions are used twice in each formula – first, to return the invoice number, and then to return the date.

Copy all the cells in this table and paste it into cell A1 on a blank worksheet in Excel.

Tip: Before you paste the data into Excel, set the column widths for columns A through D to 250 pixels, and click Wrap Text (Home tab, Alignment group).

Invoice

City

Invoice Date

Earliest invoice by city, with date

3115

Atlanta

4/7/12

=»Atlanta = «&INDEX($A$2:$C$33,MATCH(«Atlanta»,$B$2:$B$33,0),1)& «, Invoice date: » & TEXT(INDEX($A$2:$C$33,MATCH(«Atlanta»,$B$2:$B$33,0),3),»m/d/yy»)

3137

Atlanta

4/9/12

=»Austin = «&INDEX($A$2:$C$33,MATCH(«Austin»,$B$2:$B$33,0),1)& «, Invoice date: » & TEXT(INDEX($A$2:$C$33,MATCH(«Austin»,$B$2:$B$33,0),3),»m/d/yy»)

3154

Atlanta

4/11/12

=»Dallas = «&INDEX($A$2:$C$33,MATCH(«Dallas»,$B$2:$B$33,0),1)& «, Invoice date: » & TEXT(INDEX($A$2:$C$33,MATCH(«Dallas»,$B$2:$B$33,0),3),»m/d/yy»)

3191

Atlanta

4/21/12

=»New Orleans = «&INDEX($A$2:$C$33,MATCH(«New Orleans»,$B$2:$B$33,0),1)& «, Invoice date: » & TEXT(INDEX($A$2:$C$33,MATCH(«New Orleans»,$B$2:$B$33,0),3),»m/d/yy»)

3293

Atlanta

4/25/12

=»Tampa = «&INDEX($A$2:$C$33,MATCH(«Tampa»,$B$2:$B$33,0),1)& «, Invoice date: » & TEXT(INDEX($A$2:$C$33,MATCH(«Tampa»,$B$2:$B$33,0),3),»m/d/yy»)

3331

Atlanta

4/27/12

3350

Atlanta

4/28/12

3390

Atlanta

5/1/12

3441

Atlanta

5/2/12

3517

Atlanta

5/8/12

3124

Austin

4/9/12

3155

Austin

4/11/12

3177

Austin

4/19/12

3357

Austin

4/28/12

3492

Austin

5/6/12

3316

Dallas

4/25/12

3346

Dallas

4/28/12

3372

Dallas

5/1/12

3414

Dallas

5/1/12

3451

Dallas

5/2/12

3467

Dallas

5/2/12

3474

Dallas

5/4/12

3490

Dallas

5/5/12

3503

Dallas

5/8/12

3151

New Orleans

4/9/12

3438

New Orleans

5/2/12

3471

New Orleans

5/4/12

3160

Tampa

4/18/12

3328

Tampa

4/26/12

3368

Tampa

4/29/12

3420

Tampa

5/1/12

3501

Tampa

5/6/12

VLOOKUP and INDEX-MATCH in Excel (Power Functions)

VLOOKUP and INDEX-MATCH formulas are among the most powerful functions in Excel. Lookup formulas come in handy whenever you want to have Excel automatically return the price, product ID, address, or some other associated value from a table based on some lookup value. The VLOOKUP function can be used when the lookup value is in the left column of your table or when you want to return the last value in a column. The INDEX and MATCH functions can be used in combination to do the same thing, but provide greater flexibility without some of the limitations of VLOOKUP. I’ll also mention LOOKUP and CHOOSE and EXACT and ISBLANK and ISNUMBER and ISTEXT and … 🙂, but this article is mainly about VLOOKUP and INDEX-MATCH.

To see these examples in action, download the Excel file below.

Download the Example File (LookupFormulas.xlsx)

Do you have a VLOOKUP or INDEX-MATCH challenge you need to solve? If you can’t figure it out after reading this article, go ahead and ask your question by commenting below.

This Article (bookmarks):

  • Simple VLOOKUP and INDEX-MATCH Examples
  • Wildcard Characters for Partial Match Lookups
  • Approximate Match Lookups (for Grades, Discounts, Taxes, etc.)
  • 2D Lookups Using VLOOKUP-MATCH and INDEX-MATCH-MATCH
  • 3D Lookups Using INDEX-MATCH and VLOOKUP
  • Case-Sensitive EXACT Lookup Using INDEX-MATCH
  • Multiple-Criteria Exact Lookups Using VLOOKUP and INDEX-MATCH
  • Lookups with Multiple Non-Exact Criteria Using INDEX-MATCH
  • Return the Last Numeric Value in a Column
  • Return the Last Text Value in a Column
  • Return the Last Non-BLANK Value in a Range
  • Return the Last Non-Empty Value in a Range
  • Lookup based on the Nth Match

1) Simple VLOOKUP and INDEX-MATCH Examples

VLOOKUP Example

First, here is an example of the VLOOKUP function using a simple Price List Table. We’re looking for the text «a_003» within the Item ID column and wanting to return the corresponding value from the Price column.

Excel VLOOKUP Function Example

=VLOOKUP(lookup_value,table_array,col_index_num,FALSE)

How it works: The table_array argument is a range that must have the lookup column on the left. The price column is the 3rd column in the highlighted range, so that is why the col_index_num argument is 3 in our example. We use FALSE for the final argument because we want the VLOOKUP function to do an exact match.

NOTES Actually, this lookup is not truly «exact» because both VLOOKUP and MATCH are not case-sensitive, but the syntax tooltip in Excel calls the option an «exact match» so we’ll just accept that and explain how to do a case-sensitive match later.

If you later insert a column in the middle of your table_array, the Price column might not be column 3 any more. To prevent your VLOOKUP formula from breaking, in place of the 3 in the example, you can use (COLUMN($E$30)-COLUMN($C$30)+1).

The default for VLOOKUP is not an exact match, so don’t forget to include FALSE as the 4th argument if you want an exact match.

INDEX-MATCH Example

Next, you’ll see that the INDEX-MATCH formula is just as simple:

Excel INDEX-MATCH Function Example

=INDEX(result_range,MATCH(lookup_value,lookup_range,0))

How it works: The MATCH function returns the position number 3 because «a_003» matches the 3rd row in the Item ID range. Next, INDEX(result_range,3) returns the 3rd value in the price list range.

The INDEX-MATCH formula is an example of a simple nested function where we use the result from the MATCH function as one of the arguments for the INDEX function. The example below shows this being done in two separate steps.

How the INDEX-MATCH Function Works

Syntax and Notes for MATCH and INDEX

MATCH returns the position number of a matched value within the lookup range.

=MATCH(lookup_value,lookup_range,match_type)

NOTES When using MATCH, the lookup_range can be a row or column, but if lookup_range is more than one row or column, MATCH will return an error.

MATCH returns the #N/A error when it does not find a match.

The match_type is optional, but the default is not 0. So, it is is best to always specify the match type.

INDEX returns a value from an array based on a row and column number.

=INDEX(array,row_number,[column_number],[area_number])

NOTES You don’t need to include the optional column_number if the array is a single column.

The optional area_number argument is only used for 3D arrays.

If your array is a row, don’t use the shortcut =INDEX(array,column_number) because that may not be compatible with other spreadsheet software. Use =INDEX(array,1,column_number) instead.

2) Use Wildcard Characters (?, *) for Partial Matches with VLOOKUP and INDEX-MATCH

Wildcard characters can be used within the lookup_value for both VLOOKUP and MATCH formulas when the lookup is text and you are doing an exact match.

Using Wildcard Characters in VLOOKUP and INDEX-MATCH

* (asterisk) matches any number of characters. For example, use «*200» to find the first value ending in 200.

? (question mark) matches any single character. For example, use «A?C*» to find the first value where «A» is the first character and «C» is the 3rd character. The second character can be anything, but only a single character.

~ (tilde) is used in front of a wildcard character to treat it as a literal character. In the 3rd example, we use «*~?*» to find the first occurrence of a product that contains an actual question mark.

3) Return Approximate Matches Using VLOOKUP and INDEX-MATCH

The following examples show how to use VLOOKUP and INDEX-MATCH to return approximate matches with numerical lookup data. Important: When using an «Approximate Match» with VLOOKUP (where the 4th argument = TRUE) and a «Less than» match with MATCH (where the 3rd argument = 1), the lookup range needs to be sorted in ascending order.

These formulas look for the largest value that is less than or equal to the lookup value.

=VLOOKUP(lookup_value,table_array,col_index_num,TRUE)
=INDEX(result_range,MATCH(lookup_value,lookup_range,1))

Example 1: Return a Grade based on Percent

Lookup Grades Using VLOOKUP

► See this in action: Download the Grade book Template

Example 2: Return a Discount Rate based on Quantity

Discount Rate Lookup Using INDEX-MATCH

Example 3: Return a Tax Rate based on Income

Tax Rate Lookup Using VLOOKUP

► See this in action: Download the Paycheck Calculator

CAUTION For an approximate match, these formulas use a very efficient search algorithm that assumes the lookup range is sorted in ascending order. If your data is not sorted, they don’t return an error value, but the result may be unpredictable.

If the lookup value is less than the first value in the lookup range, MATCH and VLOOKUP will return an error.

4) 2D Lookups Using VLOOKUP-MATCH and INDEX-MATCH-MATCH

In this example, we’ll do a mileage lookup between two cities. The formulas are basically the same as for a 1D lookup, except that we use a MATCH function to replace col_index_num in the VLOOKUP function and to replace column_number in the INDEX function.

2D Lookup Using VLOOKUP-MATCH

Using VLOOKUP

=VLOOKUP(row_lookup_value,table_array, MATCH(column_lookup_value,column_label_range,0), FALSE)

Using INDEX-MATCH-MATCH

=INDEX( result_array,
MATCH(row_lookup_value,row_label_range,0),
MATCH(column_lookup_value,column_label_range,0) )

Using HLOOKUP

=HLOOKUP(column_lookup_value,table_array, MATCH(row_lookup_value,row_label_range,0), FALSE)

5) 3D Lookups Using INDEX-MATCH and VLOOKUP

To demonstrate a 3D lookup, we’ll use mileage tables again, but this time we have a separate table for Road and Plane. The INDEX function allows you to return a value from a 3D array. You can replace the row_number, column_number, and area_number with 3 MATCH functions.

NOTE The reference argument for the INDEX function should be multiple same-size ranges surrounded by parentheses like this: (A1:D10,E1:H10), or you can use a named range.

=INDEX( (array_range1,array_range2) ,
MATCH(row_lookup_value,row_label_range,0),
MATCH(column_lookup_value,column_label_range,0),
MATCH(table_lookup_value,{"Road","Plane"},0) )

3D Lookup Using INDEX-MATCH

3D Lookup Using VLOOKUP

It is possible to do a 3D lookup using VLOOKUP. Starting with the 2D lookup formula, in place of array_table, you can use CHOOSE(table_number,table_array_1,table_array_2). You can use MATCH to find the value for table_number as in the INDEX-MATCH example above. The resulting formula would look like this:

=VLOOKUP(row_lookup_value, CHOOSE( MATCH(table_name,{"Road","Plane"},0), road_table_array, plane_table_array), MATCH(column_lookup_value,column_label_range,0), FALSE)

6) Case-Sensitive EXACT Lookup Using INDEX-MATCH

Most lookups and logical comparisons in Excel are NOT case-sensitive, meaning that both «A»=»a» and «A»=»A» would return TRUE.

The EXACT(value1,value2) function allows you to make a comparison between value1 and value2 that IS case sensitive, so EXACT(«A»,»a») returns FALSE and EXACT(«B»,»B») returns TRUE.

If you use EXACT to compare a value to a range like EXACT(«B»,A1:A20), the function returns an array of TRUE and FALSE values. You can then use a MATCH function to look for the value TRUE within the range returned by EXACT(lookup_value,lookup_range). The final lookup formula is an Excel Array Formula, so you need to press Ctrl+Shift+Enter after entering the formula.

{Ctrl+Shift+Enter} =INDEX(result_range, MATCH(TRUE,EXACT(lookup_value,lookup_range),0) )

Case-Sensitive EXACT Lookup Using INDEX-MATCH

See the references at the end of this article if you are curious about how a case-sensitive lookup can be done with VLOOKUP.

7) Multiple-Criteria Exact Lookups Using VLOOKUP and INDEX-MATCH

One way to do an exact-match using multiple criteria is to concatenate the lookup columns and do a lookup using the concatenated lookup values. VLOOKUP requires using a helper column containing the concatenated lookup columns. INDEX-MATCH does not need the helper column, but it becomes an array formula (Ctrl+Shift+Enter).

Multiple-criteria lookup using VLOOKUP and a helper column

VLOOKUP with Multiple Criteria

=VLOOKUP(value_1 & value_2,table_array,col_index_num,FALSE)

Multiple-criteria lookup using INDEX-MATCH as an array formula

INDEX-MATCH with Multiple Criteria

{Ctrl+Shift+Enter}  =INDEX(result_range,MATCH(value1 & value2, lookup_col1 & lookup_col2,0))

8) Lookups with Multiple Non-Exact Criteria Using INDEX-MATCH

When you want to use logical conditions such as A > B or A < B in your lookup, a method I like is to use INDEX-MATCH and convert the lookup_range to a TRUE or FALSE expression like lookup_range<lookup_value. Then search for the first occurrence of TRUE (using 1 as the first argument of the MATCH function). Using this method, you can have any number of conditions because multiplying true/false expressions together acts like the logical AND operator. The formula must be entered as an array formula (Ctrl+Shift+Enter), but that’s a small price to pay for relative simplicity.

INDEX-MATCH with Multiple Non-Exact Criteria

{Ctrl+Shift+Enter}  =INDEX(result_range,MATCH(1, (lookup_col1>lookup_value1) * (lookup_col2<lookup_value2) ,0) )

9) Return the Last Numeric Value in a Column

When using an approximate lookup for VLOOKUP and MATCH, you can return the last numeric value in a column if you use an extremely large number as the lookup value (to make sure it will be larger than any number in the lookup range). A common example would be to return the last value in a Balance column for a checkbook register as shown in the example below.

Return the Last Numeric Value in a Column - VLOOKUP

=VLOOKUP( 9E+100, lookup_column, 1, TRUE)

Recall that the TRUE option (for an approximate match) is the default for VLOOKUP, so that is why the formula in the checkbook example image only shows 3 arguments.

This can of course be done with INDEX-MATCH, but I prefer the VLOOKUP formula in this case because it requires only one reference to the lookup column.

=INDEX( lookup_column, MATCH( 9E+99, lookup_column, 1) )

NOTES The lookup_column can contain text values and even errors (like #N/A or #DIV/0), and those values will be ignored. The formula returns only the last numeric value.

10) Return the Last Text Value in a Column

When searching for the last text value, instead of a large numeric value for the lookup_value as in the previous example, use a «large» text value. By that, I mean a text value that would show up last if you sorted a column in alphabetical order. If you are using the English alphabet without special characters, that could be «zzzzzz.» If you are using Greek characters or symbols in your list, you could try a Unicode Character such as «🗿» as the lookup value.

=VLOOKUP( "zzzzzzz", lookup_column, 1, TRUE)
=INDEX( lookup_column, MATCH( "🗿", lookup_column, 1) )

Rather than returning the last text value, I often use just the MATCH part of this formula to return the row number of the last value. This allows you to make a dynamic named range that can be used as the source range for a drop-down list via data validation.

11) Return the Last Non-BLANK Value in a Column

If your column contains both text and numeric values, you may want a formula to return the last non-BLANK value. Using the INDEX-MATCH formula, we can search for the last numeric value and the last text value and return whichever comes last.

=INDEX( lookup_column, MAX( MATCH( "zzzzzz", lookup_column, 1), MATCH(9E+100, lookup_column,1) ) )

A more concise formula uses the LOOKUP function. The LOOKUP function allows the lookup_range to be an expression rather than a direct reference (and it can be a row or column). We can use a logical comparison and search for the last TRUE value like this:

Return the Last Non-Blank Value Using LOOKUP

=LOOKUP(42, 1/NOT(ISBLANK(lookup_range)), lookup_range)

The trick here is that the expression 1/NOT(ISBLANK(lookup_range)) returns an array of 1s for TRUE and #DIV/0 errors for FALSE. LOOKUP ignores the error values so it will return the last value in lookup_range that is not blank. The number 42 is arbitrary — it just needs to be larger than 1 to return the last value.

Using very similar formulas, you can use LOOKUP to return just the last numeric value or text value like this:

=LOOKUP( 42, 1/ISNUMBER(lookup_range), result_range)
=LOOKUP( 42, 1/ISTEXT(lookup_range), result_range)

12) Return the Last Non-Empty Value Using LOOKUP

If you are using a formula to return an empty value «» and you want to ignore those cells when searching for the last value in the range, you can use the LOOKUP formula mentioned in the last example with the expression 1/(lookup_range<>»»).

Return the Last Non-Empty Value

=LOOKUP(42, 1/(lookup_range<>""), lookup_range)

If you want to return the relative row number instead of the actual value, you can use the following formula:

=LOOKUP(42, 1/(lookup_range<>""), ROW(lookup_range)-ROW(first_cell_in_lookup_range)+1 )

13) Lookup based on the Nth Match

You can use the SMALL function to return the Nth smallest value from an array, and we can use that along with an array formula and the INDEX function to do a lookup based on the Nth match. See my Array Formula Examples article to learn more about Array Formulas and specifically the SMALL-IF formula.

In this example, we want to return the 2nd Event that matches the date 3/7/2018. Note: The curly { } brackets in the formula below are a reminder to press Ctrl+Shift+Enter to enter the formula as an Array Formula. You don’t actually type the brackets into the formula.

Lookup Based on the Nth Match

{  =INDEX(result_range,SMALL( IF(lookup_range=lookup_value, ROW(lookup_range)-ROW(first_cell_in_lookup_range)+1),occurrence))  }

How does this work? The SMALL-IF part of the formula is acting kind of like the MATCH function except that it is returning the index number for the 2nd occurrence of the match. We can use SMALL in this example because Excel stores dates as numbers.

This formula is used within the Daily Planner Template to list events and holidays occurring on a particular date.

14) VLOOKUP vs. INDEX-MATCH

Excel people like to debate about whether VLOOKUP is better than INDEX-MATCH for lookup formulas. The most common argument is that VLOOKUP is simpler and INDEX-MATCH is more powerful. Even though I usually prefer INDEX-MATCH, I think both formulas are pretty simple, and one isn’t necessarily always more powerful than the other.

If you want to do more advanced lookups with VLOOKUP, then you’ll probably need to learn how to use MATCH and CHOOSE. If you want to become a power Excel user, then you’ll also want to learn the INDEX function. So, my opinion on the VLOOKUP vs. INDEX-MATCH debate is to learn how to use them all.

In conclusion, here are some reminders applicable to both VLOOKUP and INDEX-MATCH:

  • Don’t forget the FALSE or 0 option if you are wanting an exact match, because the default parameter is to use an approximate match.
  • As a general rule, use absolute ($A$1) cell references to refer to the lookup ranges and table arrays because when you copy the lookup formula you will usually want those ranges to remain the same.
  • Check for extra blank spaces if you think a lookup formula should be finding a match, but it is not.
  • Use IFERROR to handle the error returned when an exact match is not found.

References

  • Spreadsheet Tips Workbook — vertex42.com — by Jon Wittwer and Brent Weight
  • VLOOKUP Function — support.office.com — The official documentation of the VLOOKUP function.
  • MATCH Function — support.office.com — The official documentation of the MATCH function.
  • INDEX Function — support.office.com — The official documentation of the INDEX function.
  • Case-Sensitive Match Using VLOOKUP — at ablebits.com — This shows that it IS possible, but the solution is quite complex.
  • Get Value of Last Non-Empty Cell — at exceljet.net — I think this article explains the LOOKUP function better than I did.

VLOOKUP is an Excel function to get data from a table organized vertically. Lookup values must appear in the first column of the table passed into VLOOKUP.  VLOOKUP supports approximate and exact matching, and wildcards (* ?) for partial matches. 

Vertical data | Column Numbers | Only looks right | Matching Modes | Exact Match | Approximate Match | First Match | Wildcard Match | Two-way Lookup | Multiple Criteria | #N/A Errors | Videos

Introduction

VLOOKUP is probably the most famous function in Excel, for reasons both good and bad. On the good side, VLOOKUP is easy to use and does something very useful. For new users in particular, it is immensely satisfying to watch VLOOKUP scan a table, find a match, and return a correct result. Using VLOOKUP successfully is a rite of passage for new Excel users.

On the bad side, VLOOKUP is limited and has dangerous defaults. Unlike INDEX and MATCH (or XLOOKUP), VLOOKUP needs a complete table with lookup values in the first column. This makes it hard to use VLOOKUP with multiple criteria. In addition, VLOOKUP’s default matching behavior makes it easy to get incorrect results. Fear not. The key to using VLOOKUP successfully is mastering the basics. Read on for a complete overview.

Arguments

VLOOKUP takes four arguments: lookup_value, table_array, column_index_num, and range_lookup. Lookup_value is the value to look for, and table_array is the range of vertical data to look inside. The first column of table_array must contain the lookup values to search. The column_index_num argument is the column number of the value to retrieve, where the first column of table_array is column 1. Finally, range_lookup controls match behavior. If range_lookup is TRUE, VLOOKUP will perform an approximate match. If range_lookup is FALSE, VLOOKUP will perform an exact match. Important: range_lookup is optional and defaults to TRUE, so VLOOKUP will perform an approximate match by default. See below for more information on matching.

V is for vertical

The purpose of VLOOKUP is to look up information in a table like this:

VLOOKUP is for vertical data

With the Order number in column B as the lookup_value, VLOOKUP can get the Cust. ID, Amount, Name, and State for any order. For example, to get the name for order 1004, the formula is:

=VLOOKUP(1004,B5:F9,4,FALSE) // returns "Sue Martin"

To look up horizontal data, you can use HLOOKUP, INDEX and MATCH, or XLOOKUP.

VLOOKUP is based on column numbers

When you use VLOOKUP, imagine that every column in the table_array is numbered, starting from the left. To get a value from a given column, provide the number for column_index_num. For example, the column index to retrieve the first name below is 2:

VLOOKUP is based on column numbers

By changing only column_index_num, you can look up columns 2, 3, and 4:

=VLOOKUP(H3,B4:E13,2,FALSE) // first name
=VLOOKUP(H3,B4:E13,3,FALSE) // last name
=VLOOKUP(H3,B4:E13,4,FALSE) // email address

Note: normally, we would use an absolute reference for H3 ($H$3) and B4:E13 ($B$4:$E$13) to prevent these from changing when the formula is copied. Above, the references are relative to make them easier to read.

VLOOKUP only looks right

VLOOKUP can only look to the right. In other words, you can only retrieve data to the right of the column that holds lookup values:

VLOOKUP can only look to the right

To look up values to the left, see INDEX and MATCH, or XLOOKUP.

Match modes

VLOOKUP has two modes of matching, exact and approximate, controlled by the fourth argument, range_lookup. The word «range» in this case refers to «range of values» – when range_lookup is TRUE, VLOOKUP will match a range of values rather than an exact value. A good example of this is using VLOOKUP to calculate grades. When range_lookup is FALSE, VLOOKUP performs an exact match, as in the example above.

Important: range_lookup is optional defaults to TRUE. This means approximate match mode is the default, which can be dangerous. Set range_lookup to FALSE to force exact matching:

=VLOOKUP(value,table,col_index) // approximate match (default)
=VLOOKUP(value,table,col_index,TRUE) // approximate match
=VLOOKUP(value,table,col_index,FALSE) // exact match

Tip: always supply a value for range_lookup as a reminder of expected behavior.

Note: You can also supply zero (0) for an exact match, and 1 for an approximate match.

Exact match example

In most cases, you’ll probably want to use VLOOKUP in exact match mode. This makes sense when you have a unique key to use as a lookup value, for example, the movie title in this data:

VLOOKUP exact match with movies

The formula in H6 to find Year, based on an exact match of the movie title, is:

=VLOOKUP(H4,B5:E9,2,FALSE) // FALSE = exact match

Approximate match example

In some cases, you will need an approximate match lookup instead of an exact match lookup. For example, below we want to find the correct commission percentage in the range G5:H10 based on the sales amount in column C. In this example, we need to use VLOOKUP in approximate match mode, because in most cases an exact match will never be found. The VLOOKUP formula in D5 is configured to perform an approximate match by setting the last argument to TRUE:

VLOOKUP approximate match commission rate

=VLOOKUP(C5,$G$5:$H$10,2,TRUE) // TRUE = approximate match

VLOOKUP will scan values in column G for the lookup value. If an exact match is found, VLOOKUP will use it. If not, VLOOKUP will «step back» and match the previous row.

Note: The table_array must be sorted in ascending order by lookup value to use an approximate match. If table_array is not sorted by the first column in ascending order, VLOOKUP may return incorrect or unexpected results.

First match only

In the case of duplicate matching values, VLOOKUP will find the first match. In the screen below, VLOOKUP is configured to find the price for the color «Green». There are three rows with the color Green, and VLOOKUP returns the price in the first row, $17. The formula in cell F5 is:

=VLOOKUP(E5,B5:C11,2,FALSE) // returns 17

VLOOKUP returns first match

Tip: To retrieve multiple matches with a lookup operation, see the FILTER function.

Wildcard match

The VLOOKUP function supports wildcards, which makes it possible to perform a partial match on a lookup value. For instance, you can use VLOOKUP to retrieve information from a table with a partial lookup_value and wildcard. To use wildcards with VLOOKUP, you must use exact match mode by providing FALSE for range_lookup. In the screen below, the formula in H7 retrieves the first name, «Michael», after typing «Aya» into cell H4. Notice the asterisk (*) wildcard is concatenated to the lookup value inside the VLOOKUP formula:

=VLOOKUP($H$4&"*",$B$5:$E$104,2,FALSE)

VLOOKUP wildcard match

Read a more detailed explanation here.

Two-way lookup

Inside the VLOOKUP function, column_index_num is normally hard-coded as a static number. However, you can create a dynamic column index by using the MATCH function to locate the needed column. This technique allows you to create a dynamic two-way lookup, matching on both rows and columns. In the screen below, VLOOKUP is configured to perform a lookup based on Name and Month like this:

=VLOOKUP(H4,B5:E13,MATCH(H5,B4:E4,0),0)

VLOOKUP two-way lookup

For more details, see this example.

Note: In general, INDEX and MATCH is a more flexible way to perform two-way lookups.

Multiple criteria

The VLOOKUP function does not handle multiple criteria natively. However, you can use a helper column to join multiple fields together and use these fields like multiple criteria inside VLOOKUP.  In the example below, Column B is a helper column that concatenates first and last names together with this formula:

=C5&D5 // helper column

VLOOKUP is configured to do the same thing to create a lookup value. The formula in H6 is:

=VLOOKUP(H4&H5,B5:E13,4,0)

VLOOKUP with multiple criteria

For details, see this example. For a more advanced, flexible approach, see this example.

Note: INDEX and MATCH and XLOOKUP are better for lookups based on multiple criteria.

VLOOKUP and #N/A errors

If you use VLOOKUP you will inevitably run into the #N/A error. The #N/A error means «not found». For example, in the screen below, the lookup value «Toy Story 2» does not exist in the lookup table, and all three VLOOKUP formulas return #N/A:

VLOOKUP #N/A error example

The #N/A error is useful because tells you something is wrong. The reason for #N/A might be:

  • The lookup value does not exist in the table
  • The lookup value is misspelled or contains extra space
  • Match mode is exact, but should be approximate
  • The table range is not entered correctly
  • You are copying VLOOKUP, and the table reference is not locked

To «trap» the NA error and return a different value, you can use the IFNA function like this:

VLOOKUP #N/A error example - fixed

The formula in H6 is:

=IFNA(VLOOKUP(H4,B5:E9,2,FALSE),"Not found")

The message can be customized as desired. To return nothing (i.e. to display a blank result) when VLOOKUP returns #N/A you can use an empty string («») like this:

=IFNA(VLOOKUP(H4,B5:E9,2,FALSE),"") // no message

You can also use the IFERROR function to trap VLOOKUP #N/A errors. However, be careful with IFERROR, because it will catch any error, not just the #N/A error. Read more: VLOOKUP without #N/A errors 

More about VLOOKUP

  • VLOOKUP with multiple criteria (basic)
  • VLOOKUP with multiple criteria (advanced)
  • How to use VLOOKUP to merge tables
  • 23 tips for using VLOOKUP
  • More VLOOKUP examples and videos
  • XLOOKUP vs VLOOKUP

Other notes

  • VLOOKUP performs an approximate match by default.
  • VLOOKUP is not case-sensitive.
  • Range_lookup controls the match mode. FALSE = exact, TRUE = approximate (default).
  • If range_lookup is omitted or TRUE or 1: 
    • VLOOKUP will match the nearest value less than the lookup_value.
    • VLOOKUP will still use an exact match if one exists.
    • The column 1 of table_array must be sorted in ascending order.
  • If range_lookup is FALSE or zero:
    • VLOOKUP performs an exact match.
    • Column 1 of table_array does not need to be sorted.

Excel VLookup Multiple Criteria with INDEX MATCH in 4 Easy Steps (+ Free Easy-To-Adjust Excel Workbook Example)In this Excel VLookup Multiple Criteria (with INDEX MATCH) Tutorial, you learn how to carry out a VLookup for multiple criteria, with the following constructs:

  • An array formula.
  • The INDEX function.
  • The MATCH function.

The VLookup multiple criteria (with INDEX MATCH) formula template/structure you learn in this Tutorial isn’t the only way to carry out a VLookup for multiple criteria. You may (also) be interested in the following alternative formula template/structures:

  • Excel VLookup Multiple Criteria with XLOOKUP.
  • Excel VLookup Multiple Criteria with the FILTER Function.

I link to these Tutorials in the Related Excel Training Materials and Resources Section below.

This Excel VLookup Multiple Criteria (with INDEX MATCH) Tutorial is accompanied by an Excel workbook with the data and formulas I use when describing the step-by-step process below. Get this example workbook (for free) by clicking the button below.

Get immediate free access to the Excel VLookup multiple criteria with INDEX MATCH workbook example

This Excel VLookup Multiple Criteria (with INDEX MATCH) Tutorial is part of a more comprehensive series of Excel VLookup Tutorials.

  • Excel VLOOKUP (under development): Click here to open.
  • Excel VLOOKUP from Another Sheet in 4 Easy Steps: Click here to open.
  • Excel VLOOKUP Compare 2 Columns and Find Matches in 4 Easy Steps: Click here to open.
  • Excel VLookup Sum Multiple Row Values (in Same Column) in 4 Easy Steps: Click here to open.
  • Excel VLOOKUP Multiple Columns in 5 Easy Steps: Click here to open.
  • Excel VLOOKUP Sum Multiple Columns (Values) in 6 Easy Steps: Click here to open.
  • Excel VLookup Sum Multiple Column Values (with XLOOKUP) in 4 Easy Steps: Click here to open.
  • Excel VLookup Sum Multiple Rows and Columns in 3 Easy Steps: Click here to open.
  • Excel VLookup Multiple Criteria with XLOOKUP in 2 Easy Steps: Click here to open.
  • Excel VLookup Multiple Criteria with the FILTER Function in 2 Easy Steps: Click here to open.
  • Excel VLOOKUP Return Multiple Values with Helper Column in 4 Easy Steps: Click here to open.
  • Excel VLookup Return Multiple Values with the INDEX Function in 7 Easy Steps: Click here to open.
  • Excel VLookup Return Multiple Values with the FILTER Function in 2 Easy Steps: Click here to open.
  • Excel VLookup Return Multiple Values in One Cell Separated by a Comma in 4 Easy Steps: Click here to open.
  • Excel VLOOKUP Multiple Sheets in 10 Easy Steps: Click here to open.
  • Excel VLOOKUP Multiple Sheets in Different Workbook in 10 Easy Steps: Click here to open.
  • Excel VLOOKUP Sheet in Multiple Different Workbooks in 10 Easy Steps: Click here to open.

My Excel XLOOKUP Tutorial (click here to open) may help you:

  • Better understand and implement the contents below.
  • Better understand the differences between the XLOOKUP and VLOOKUP functions (XLOOKUP vs. VLOOKUP).

You can find more Excel Tutorials in the organized Tutorials Archive: Click here to visit the Archives. The following are some of my most popular Excel Tutorials:

  • Excel Macro Tutorial for Beginners: Click here to open.
  • Excel Power Query (Get & Transform) Tutorial for Beginners: Click here to open.
  • 350 + Excel Keyboard Shortcuts And Hotkeys: Click here to open.

If you want to learn more about Excel essentials, Excel formulas, and similar Excel topics, you may be interested in taking one (or more) Excel Courses: Click here to learn more about these Excel Courses (affiliate link). The following are some of the topics covered in these Excel Courses:

  • Excel essentials and must-know skills.
  • Advanced Excel Formulas.
  • Excel Tables.
  • Pivot Tables.
  • Dashboards.
  • Power Pivot.
  • Power Query.

If you want to start learning how to automate Excel (and save time) by working with macros and VBA, you may be interested in the following Premium Excel Macro and VBA Training Materials:

  • Premium Courses at the Power Spreadsheets Academy: Click here to open.
  • Books at the Power Spreadsheets Library: Click here to open.

If you need consulting services, you may want to consider working with ExcelRescue. ExcelRescue is my usual suggestion for people who (like you) may need help with Excel tasks/projects: Click here to visit ExcelRescue (affiliate link).

Get immediate free access to the Excel VLookup multiple criteria with INDEX MATCH workbook example

The VLookup Multiple Criteria (with INDEX MATCH) Formula Template/Structure

The following is the VLookup multiple criteria (with INDEX MATCH) formula template/structure I explain (step-by-step) in the Sections below.

'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/vlookup-multiple-index-match/
=INDEX(ColumnWithValueToReturn,MATCH(1,(Criterion1=ColumnWithCriterion1)*(Criterion2=ColumnWithCriterion2)*(Criterion3=ColumnWithCriterion3)*…*(Criterion#=ColumnWithCriterion#),0))

This is an array formula. If you’re working with Excel 2019 or earlier, enter this formula by pressing “Ctrl + Shift + Enter”. In these cases, Excel wraps the formula in curly braces ({}).

'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/vlookup-multiple-index-match/
{=INDEX(ColumnWithValueToReturn,MATCH(1,(Criterion1=ColumnWithCriterion1)*(Criterion2=ColumnWithCriterion2)*(Criterion3=ColumnWithCriterion3)*…*(Criterion#=ColumnWithCriterion#),0))}

Get immediate free access to the Excel VLookup multiple criteria with INDEX MATCH workbook example

The Example Before VLookup Multiple Criteria (with INDEX MATCH)

This Excel VLookup Multiple Criteria (with INDEX MATCH) Tutorial is accompanied by an Excel workbook with the data and formulas I use when describing the step-by-step process below. Get this example workbook (for free) by clicking the button below.

Get immediate free access to the Excel VLookup multiple criteria with INDEX MATCH workbook example

The example worksheet has 2 tables with the following characteristics.

(1) Table 1 (Cells A7 to G27).

The table:

  • With the data.
  • Where you search with the VLookup multiple criteria (with INDEX MATCH) example formula.

Main characteristics:

  • 7 columns (Salesperson, Date, Customer, Product, City, Units, Unit Price).
  • 1 header row (row 7).
  • 20 entries (rows 8 to 27).

(2) Table 2 (Cells I7 to L14).

The table where you:

  • Set up the VLookup multiple criteria (with INDEX MATCH) example formulas.
  • Display the results.

This table has the following 4 columns:

  • Column: Cells I8 to I14 store letters. These letters match the columns of Table 1.
  • Header: The values in cells J8 to J14 match the headers of Table 1 (cells A7 to G7).
  • Value:
    • Cells K8 and K9: The 2 (multiple) VLookup criteria.
    • Cells K10 to K14:
      • Currently empty.
      • Will store the VLookup multiple criteria (with INDEX MATCH) example formulas.
  • Formula: Cells L10 to L14:
    • Currently display the #N/A error.
    • Will display the VLookup multiple criteria (with INDEX MATCH) example formulas I enter in cells K10 to K14.

The following image displays the example worksheet before I add the VLookup multiple criteria (with INDEX MATCH) example formulas.

Example Excel data set for VLookup multiple criteria (INDEX MATCH)

Get immediate free access to the Excel VLookup multiple criteria with INDEX MATCH workbook example

Step 1: Set Up the Multiple Conditions

Create an expression that does the following:

  1. Evaluate multiple conditions.
  2. Return a single value for each row (in the table where you search with the VLookup multiple criteria formula), indicating whether all conditions are met (or not) in that specific row.

To do this inside a VLookup multiple criteria (with INDEX MATCH) formula, you work with logical expressions. Logical expressions

  • Return a Boolean value (TRUE or FALSE) when evaluated.
  • Allow you to test whether a set of multiple conditions is met.

Use the following template/structure to create the expression testing the multiple conditions:

'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/vlookup-multiple-index-match/
(Criterion1=ColumnWithCriterion1)*(Criterion2=ColumnWithCriterion2)*(Criterion3=ColumnWithCriterion3)*…*(Criterion#=ColumnWithCriterion#)

This expression template/structure works with the following 2 operators to test whether a set of multiple conditions is met:

  • The equal to comparison operator: =.
    • Compares 2 expressions and returns a Boolean value (TRUE or FALSE) as follows:
      • TRUE if the 2 expressions are equal (Expression1=Expression2).
      • FALSE if the 2 expressions aren’t equal (Expression1<>Expression2).
  • The multiplication operator (*):
    • As a general rule, multiplies 2 numbers.
    • When multiplying Boolean values (TRUE and FALSE), converts the Boolean values into 0s and 1s as follows:
      • TRUE is converted to 1.
      • FALSE is converted to 0.
    • When creating a VLookup multiple criteria (with INDEX MATCH) formula, the multiplication operator (*) acts as the AND logical operator. In other words: The entire expression returns 1 (TRUE) or 0 (FALSE) as follows:
      • 1 (TRUE) if all evaluated conditions return 1 (TRUE).
      • 0 (FALSE) if any (or all) evaluated condition(s) return 0 (FALSE).

Consider the following when specifying the expression testing the multiple conditions:

  • Carry out as many equal to comparison tests (with the equal to operator; =) as needed (1 equal to comparison test per criterion) to compare each of the multiple criteria against the cells in a column (with the respective criterion).
  • Specify the column with a criterion (ColumnWithCriterion#) as a single-column (1 column, several rows) cell range.

In the VLookup multiple criteria (with INDEX MATCH) formula, the expression template/structure I describe above returns an array of 0s and 1s, by applying the 2 operators above in the following order of precedence:

  • First:
    • The equal to comparison operator (=) is evaluated.
    • Each expression with the equal to comparison operator (=) returns an array with TRUEs and FALSEs. Each individual TRUE or FALSE indicates whether the applicable criterion (Criterion#) is met by the applicable row in the applicable column (ColumnWithCriterion#).
  • Second:
    • The multiplication operator (*) is evaluated.
    • The entire expression with the multiplication operator(s) (*) returns an array with 1s (TRUE) and 0s (FALSE). Each individual 1 (TRUE) or 0 (FALSE) indicates whether all applicable criteria are met by all applicable columns in the applicable row.

Get immediate free access to the Excel VLookup multiple criteria with INDEX MATCH workbook example

Step 1 Example

In the example, 2 conditions must be met:

  • Condition 1: The Product (in column D) is equal to the product in cell K8.
  • Condition 2: The City (in column E) is equal to the city in cell K9.

When implementing the template/structure I describe above:

  • Criterion1: Cell K8 ($K$8, when using absolute references).
  • ColumnWithCriterion1: Cells D8 to D27 ($D$8:$D$27, when using absolute references).
  • Criterion2: Cell K9 ($K$9, when using absolute references).
  • ColumnWithCriterion2: Cells E8 to E27 ($E$8:$E$27, when using absolute references).
'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/vlookup-multiple-index-match/
($K$8=$D$8:$D$27)*($K$9=$E$8:$E$27)

The image below illustrates how the array of 0s and 1s (I mention above) is returned by this expression:

  1. Columns H (Criterion1) and I (Criterion2) return TRUE or FALSE, depending on whether the criterion (Criterion#) is met by the applicable row in the applicable column (column D for Criterion1, column E for Criterion2).
  2. Column J (Criterion1*Criterion2) returns 0 or 1, depending on whether all criteria (Criterion1 and Criterion2) are met by all applicable columns (column D and column E) in the applicable row.
  3. Column K (Step 1 Array):
    • Uses the basic structure of the expression testing the multiple conditions (I describe above).
    • Returns 0 or 1, depending on whether all criteria (Criterion1 and Criterion2) are met by all applicable columns (column D and column E). These results are exactly the same as those returned by the (illustrative) process carried out in columns H, I, and J.
  4. Cell L8 displays the formula (using the basic structure of the expression testing the multiple conditions) stored in column K.
Example: Set up multiple conditions for Excel VLookup multiple criteria (INDEX MATCH)

The 2 (multiple) conditions are met in row 24 of the worksheet.

Get immediate free access to the Excel VLookup multiple criteria with INDEX MATCH workbook example

Step 2: Use the MATCH Function to Find the Row Where the Multiple Conditions are Met

In the VLookup multiple criteria (with INDEX MATCH) formula, the MATCH function does the following:

  1. Search for an item in an array; and
  2. Return the relative position of the item in the array.

Specify MATCH’s arguments as follows to find the row where the multiple conditions are met:

  1. lookup_value: 1.
  2. lookup_array: The expression (returning an array of 0s and 1s) you created in step #1.
  3. match_type: 0.
'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/vlookup-multiple-index-match/
MATCH(1,ArrayFromStep1,0)

When considering the array you created in step #1:

'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/vlookup-multiple-index-match/
MATCH(1,(Criterion1=ColumnWithCriterion1)*(Criterion2=ColumnWithCriterion2)*(Criterion3=ColumnWithCriterion3)*…*(Criterion#=ColumnWithCriterion#),0)

Consider the following when setting up the MATCH function inside the VLookup multiple criteria (with INDEX MATCH) formula:

  • As a general rule, if the criteria columns you work with (to specify the array of 0s and 1s you created in step #1) have duplicate values (several rows match the multiple criteria, resulting in several rows matching the lookup_value of 1), the MATCH function works with the first entry matching the lookup_value (1).
  • The MATCH function is case insensitive (when matching text values).
  • If the MATCH function doesn’t find an exact match for the lookup_value (1), it returns the #N/A error.

Get immediate free access to the Excel VLookup multiple criteria with INDEX MATCH workbook example

Step 2 Example

In the VLookup multiple criteria (with INDEX MATCH) example formula, the MATCH function (using absolute references) is as follows:

'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/vlookup-multiple-index-match/
MATCH(1,($K$8=$D$8:$D$27)*($K$9=$E$8:$E$27),0)

The image below displays the relative position of the (sought) number 1 (row number inside the table where you search with the VLookup multiple criteria example formula where all criteria are met) in the array of 0s and 1s (you created in step #1).

  • Cells L10 to L14 display the position of the (sought) number 1 in the array of 0s and 1s.
  • Cells M10 to M14 display the function template/structure I explain above (with MATCH), as used in cells L10 to L14.
  • Column H displays the relative position of each row in the array.
Example: MATCH function finds row where several conditions (for VLookup multiple criteria) are met

The relative position of row 24 (where the multiple conditions are met, as you found in step #2) in the array is 17.

Get immediate free access to the Excel VLookup multiple criteria with INDEX MATCH workbook example

In the VLookup multiple criteria (with INDEX MATCH) formula, the INDEX function returns the value in a specific row in a single-column (1 column, several rows) cell range.

Specify INDEX’s arguments as follows to obtain the value the VLookup multiple criteria (with INDEX MATCH) formula returns:

  1. array: The single-column (1 column, several rows) cell range (in the table where you search with the VLookup multiple criteria formula) with the value to return.
  2. row_num: The MATCH formula you created in step #2.
'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/vlookup-multiple-index-match/
=INDEX(ColumnWithValueToReturn,MATCH(1,ArrayFromStep1,0))

When considering the full MATCH function you created in step #2:

'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/vlookup-multiple-index-match/
=INDEX(ColumnWithValueToReturn,MATCH(1,(Criterion1=ColumnWithCriterion1)*(Criterion2=ColumnWithCriterion2)*(Criterion3=ColumnWithCriterion3)*…*(Criterion#=ColumnWithCriterion#),0))

Get immediate free access to the Excel VLookup multiple criteria with INDEX MATCH workbook example

Step 3 Example

The VLookup multiple criteria (with INDEX MATCH) example formulas (using absolute references) are as follows:

  • Cell K10:
'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/vlookup-multiple-index-match/
=INDEX(A$8:A$27,MATCH(1,($K$8=$D$8:$D$27)*($K$9=$E$8:$E$27),0))
  • Cell K11:
'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/vlookup-multiple-index-match/
=INDEX(B$8:B$27,MATCH(1,($K$8=$D$8:$D$27)*($K$9=$E$8:$E$27),0))
  • Cell K12:
'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/vlookup-multiple-index-match/
=INDEX(C$8:C$27,MATCH(1,($K$8=$D$8:$D$27)*($K$9=$E$8:$E$27),0))
  • Cell K13:
'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/vlookup-multiple-index-match/
=INDEX(F$8:F$27,MATCH(1,($K$8=$D$8:$D$27)*($K$9=$E$8:$E$27),0))
  • Cell K14:
'Source: https://powerspreadsheets.com/
'More information: https://powerspreadsheets.com/vlookup-multiple-index-match/
=INDEX(G$8:G$27,MATCH(1,($K$8=$D$8:$D$27)*($K$9=$E$8:$E$27),0))

The formulas above differ (exclusively) on the column specified as array argument of the INDEX function. That’s the column (in the table where you search with the VLookup multiple criteria formula) with the value to return.

  • Cell K10: Returns a value from column A (Salesperson).
  • Cell K11: Returns a value from column B (Date).
  • Cell K12: Returns a value from column C (Customer).
  • Cell K13: Returns a value from column F (Units).
  • Cell K14: Returns a value from column G (Unit Price).

The image below displays the final results returned by the VLookup multiple criteria (with INDEX MATCH) example formulas.

  • Cells K10 to K14 display the value returned by the applicable VLookup multiple criteria (with INDEX MATCH) example formula, as follows:
    • Cell K10: The value in cell A24 (Salesperson 50).
    • Cell K11: The value in cell B24 (22-May-19).
    • Cell K12: The value in cell C24 (Customer 5).
    • Cell K13: The value in cell F24 (84.00).
    • Cell K14: The value in cell G24 (499.99).
  • Cells L10 to L14 display the VLookup multiple criteria (with INDEX MATCH) example formulas, as used in cells K10 to K14.
Example: INDEX function extracts value in row where several conditions are met (for VLookup multiple criteria)

Get immediate free access to the Excel VLookup multiple criteria with INDEX MATCH workbook example

Step 4: Enter the Formula as an Array Formula

The VLookup multiple criteria (with INDEX MATCH) formula template/structure you learned in this Tutorial is an array formula.

If you’re working with Excel 2019 or earlier, enter this VLookup multiple criteria (with INDEX MATCH) formula by pressing “Ctrl + Shift + Enter”. In these cases, Excel wraps the formula in curly braces ({}).

Get immediate free access to the Excel VLookup multiple criteria with INDEX MATCH workbook example

Step 4 Example

The image below displays the VLookup multiple criteria (with INDEX MATCH) example formulas wrapped in curly braces ({}) if I press “Ctrl + Shift + Enter” to enter them. The results are the same as those displayed in step #3.

  • Cells K10 to K14 display the value returned by the applicable VLookup multiple criteria (with INDEX MATCH) example formula, as follows:
    • Cell K10: The value in cell A24 (Salesperson 50).
    • Cell K11: The value in cell B24 (22-May-19).
    • Cell K12: The value in cell C24 (Customer 5).
    • Cell K13: The value in cell F24 (84.00).
    • Cell K14: The value in cell G24 (499.99).
  • Cells L10 to L14 display the VLookup multiple criteria (with INDEX MATCH) example formulas, as used in cells K10 to K14.
Example: Enter Excel VLookup multiple criteria (INDEX MATCH) as array formula

Get immediate free access to the Excel VLookup multiple criteria with INDEX MATCH workbook example

Download the VLookup Multiple Criteria (with INDEX MATCH) Example Workbook

This Excel VLookup Multiple Criteria (with INDEX MATCH) Tutorial is accompanied by an Excel workbook with the data and formulas I use when describing the step-by-step process above. Get this example workbook (for free) by clicking the button below.

Get immediate free access to the Excel VLookup multiple criteria with INDEX MATCH workbook example

This Excel VLookup Multiple Criteria (with INDEX MATCH) Tutorial is part of a more comprehensive series of Excel VLookup Tutorials.

  • Excel VLOOKUP (under development): Click here to open.
  • Excel VLOOKUP from Another Sheet in 4 Easy Steps: Click here to open.
  • Excel VLOOKUP Compare 2 Columns and Find Matches in 4 Easy Steps: Click here to open.
  • Excel VLookup Sum Multiple Row Values (in Same Column) in 4 Easy Steps: Click here to open.
  • Excel VLOOKUP Multiple Columns in 5 Easy Steps: Click here to open.
  • Excel VLOOKUP Sum Multiple Columns (Values) in 6 Easy Steps: Click here to open.
  • Excel VLookup Sum Multiple Column Values (with XLOOKUP) in 4 Easy Steps: Click here to open.
  • Excel VLookup Sum Multiple Rows and Columns in 3 Easy Steps: Click here to open.
  • Excel VLookup Multiple Criteria with XLOOKUP in 2 Easy Steps: Click here to open.
  • Excel VLookup Multiple Criteria with the FILTER Function in 2 Easy Steps: Click here to open.
  • Excel VLOOKUP Return Multiple Values with Helper Column in 4 Easy Steps: Click here to open.
  • Excel VLookup Return Multiple Values with the INDEX Function in 7 Easy Steps: Click here to open.
  • Excel VLookup Return Multiple Values with the FILTER Function in 2 Easy Steps: Click here to open.
  • Excel VLookup Return Multiple Values in One Cell Separated by a Comma in 4 Easy Steps: Click here to open.
  • Excel VLOOKUP Multiple Sheets in 10 Easy Steps: Click here to open.
  • Excel VLOOKUP Multiple Sheets in Different Workbook in 10 Easy Steps: Click here to open.
  • Excel VLOOKUP Sheet in Multiple Different Workbooks in 10 Easy Steps: Click here to open.

My Excel XLOOKUP Tutorial (click here to open) may help you:

  • Better understand and implement the contents above.
  • Better understand the differences between the XLOOKUP and VLOOKUP functions (XLOOKUP vs. VLOOKUP).

You can find more Excel Tutorials in the organized Tutorials Archive: Click here to visit the Archives. The following are some of my most popular Excel Tutorials:

  • Excel Macro Tutorial for Beginners: Click here to open.
  • Excel Power Query (Get & Transform) Tutorial for Beginners: Click here to open.
  • 350 + Excel Keyboard Shortcuts And Hotkeys: Click here to open.

If you want to learn more about Excel essentials, Excel formulas, and similar Excel topics, you may be interested in taking one (or more) Excel Courses: Click here to learn more about these Excel Courses (affiliate link). The following are some of the topics covered in these Excel Courses:

  • Excel essentials and must-know skills.
  • Advanced Excel Formulas.
  • Excel Tables.
  • Pivot Tables.
  • Dashboards.
  • Power Pivot.
  • Power Query.

If you want to start learning how to automate Excel (and save time) by working with macros and VBA, you may be interested in the following Premium Excel Macro and VBA Training Materials:

  • Premium Courses at the Power Spreadsheets Academy: Click here to open.
  • Books at the Power Spreadsheets Library: Click here to open.

If you need consulting services, you may want to consider working with ExcelRescue. ExcelRescue is my usual suggestion for people who (like you) may need help with Excel tasks/projects: Click here to visit ExcelRescue (affiliate link).

LOOKUP tables in Excel are named tables used with the VLOOKUP function to find any data. When we have a large amount of data and do not know where to look, we can select the table and name it. While using the VLOOKUP function, instead of providing the reference, we can type the table’s name as a reference to look up the value. Such a table is known as a lookup table in Excel.

How to Create a Lookup Table in Excel?

LOOKUP functions are lifesavers in Excel. Based on the available or lookup value, we can fetch the other data in different tables. In Excel, VLOOKUP is the most commonly used LOOKUP function.

This article will discuss some of the important lookup functions in Excel and how to create a lookup table in Excel. Important lookup functions are VLOOKUP and HLOOKUP, V stands for vertical lookup, and H stands for horizontal lookup. We have the function called LOOKUP to look for the data in the table.

Lookup Table in Excel

You are free to use this image on your website, templates, etc, Please provide us with an attribution linkArticle Link to be Hyperlinked
For eg:
Source: Lookup Table in Excel (wallstreetmojo.com)

We can fetch the available data and other information from different worksheets and workbooks using these LOOKUP functions.

Table of contents
  • How to Create a Lookup Table in Excel?
    • #1 – Create a Lookup Table Using VLOOKUP Function
    • #2 – Use LOOKUP Function to Create a LOOKUP Table in Excel
    • #3 – Use INDEX + MATCH Function
    • Things to Remember
    • Recommended Articles

You can download this Create LOOKUP Table Excel Template here – Create LOOKUP Table Excel Template

#1 – Create a Lookup Table Using VLOOKUP Function

As we said, VLOOKUP is the traditional lookup functionThe VLOOKUP excel function searches for a particular value and returns a corresponding match based on a unique identifier. A unique identifier is uniquely associated with all the records of the database. For instance, employee ID, student roll number, customer contact number, seller email address, etc., are unique identifiers.
read more
most users use regularly. Therefore, we will show you how to look for values using this LOOKUP function.

VLOOKUP Formula

  • Lookup Value is nothing but the available value. Based on this value, we are trying to fetch the data from the other table.
  • Table Array is simply the main table where all the information resides.
  • Col Index Num is nothing but from which column of the table array we want the data. So we need to mention the column number here.
  • Range Lookup is nothing but whether you are looking for an exact match or an approximate match. If you are looking for the same match, then FALSE or 0 is the argument. If you are looking for the approximate match, then TRUE or 1 is the argument.

Example of VLOOKUP Function: Assume below is the data you have of product sales and their sales amount.

VLOOKUP Function Step 1

Now, in cell D2, we have one product ID, and using this product ID, we have to fetch the sales value using VLOOKUP.

VLOOKUP Function Step 2

Follow these steps:

  1. We must apply the VLOOKUP function and open the formula first.

    VLOOKUP Function Step 3

  2. The first argument is the LOOKUP value. It is our base or available value. So, we must select cell D2 as the reference.

    VLOOKUP Function Step 4

  3. Next is the table array. It is nothing but our main table where all the data resides. So, select the table array as A2 to B11.

    VLOOKUP Function Step 5

  4. Now, press the F4 function key to make it an absolute excel reference. It will insert the dollar symbol into the selected cell.

    VLOOKUP Function Step 6

  5. The next argument is the column index number from the selected table from which column we are looking for the data. In this case, we have chosen two columns, and we need the data from the second column, so we must mention 2 as the argument.

    VLOOKUP Function Step 7

  6. The final argument is range lookup, i.e., type of lookup. Since we are looking at an exact match, we must select FALSE or insert zero as the argument.

    VLOOKUP Function Step 8

  7. Close the bracket and press the “Enter” key. We should have the sales value for the product ID Prd5.

    VLOOKUP Function Step 9

  8. What if we want the sales data for the product if Prd6. Of course, we can enter directly, but this is not the right approach. Rather, we can create the drop-down list in excel and allow the user to select from the drop-down list. Press ALT + A + V + V in cell D2. It is the shortcut key, which is the shortcut key to create data validation in excel.

    VLOOKUP Function Step 10

  9. Select the “LIST” from the “Allow:” drop-down.

    VLOOKUP Function Step 11

  10. In the “SOURCE:” select the Product ID list from A2 to A11.

    VLOOKUP Function Step 12

  11. Click on the “OK.” We have all the list of products in cell D2 now.

    VLOOKUP Function Step 13

#2 – Use LOOKUP Function to Create a LOOKUP Table in Excel

Instead of VLOOKUP, we can also use the LOOKUP function in excelThe LOOKUP excel function searches a value in a range (single row or single column) and returns a corresponding match from the same position of another range (single row or single column). The corresponding match is a piece of information associated with the value being searched.
read more
as an alternative. But, first, let us look at the formula of the LOOKUP function.

LOOKUP Formula

  • Lookup Value is the base value or available value.
  • Lookup Vector is nothing but a lookup value column in the main table.
  • Result Vector is nothing but requires a column in the main table.

Let’s apply the formula to understand the logic of the LOOKUP function.

Step 1: We must open the LOOKUP function now.

LOOKUP Table Step 1

Step 2: The lookup value is product ID, so select the D2 cell.

LOOKUP Table Step 2

Step 3: The lookup vector is nothing but the product ID column in the main table. So select A1 to A11 as the range.

LOOKUP Table Step 3

Step 4: Next is the results vector. It is nothing but from which column we need the data to be fetched. In this case, from B1 to B11, we want the data to be brought.

LOOKUP Table Step 4

Step 5: Close the bracket and press the “Enter” key to close the formula. We should have sales value for the selected product ID.

LOOKUP Table Step 5

Step 6: Change the product ID to see a different result.

Step 6

#3 – Use INDEX + MATCH Function

The VLOOKUP function can fetch the data from left to the right, but with the help of the INDEX FunctionThe INDEX function in Excel helps extract the value of a cell, which is within a specified array (range) and, at the intersection of the stated row and column numbers.read more and MATCH formula in excelThe MATCH function looks for a specific value and returns its relative position in a given range of cells. The output is the first position found for the given value. Being a lookup and reference function, it works for both an exact and approximate match. For example, if the range A11:A15 consists of the numbers 2, 9, 8, 14, 32, the formula “MATCH(8,A11:A15,0)” returns 3. This is because the number 8 is at the third position.
read more
, we can bring data from anywhere to create a LOOKUP Excel table.

Step 1: Open the INDEX formula ExcelThe INDEX function in Excel helps extract the value of a cell, which is within a specified array (range) and, at the intersection of the stated row and column numbers.read more first.

Use INDEX + MATCH Step 1 (lookup table in excel)

Step 2: Select the result column in the main table for the first argument.

Use INDEX + MATCH Step 2 (lookup table in excel)

Step 3: To get the row number, we need to apply the MATCH function. Refer to the below image for the MATCH function.

Use INDEX + MATCH Step 3 (lookup table in excel)

Step 4: Close the bracket and close the formula. We will have results.

Use INDEX + MATCH Step 4

Things to Remember

  • The LOOKUP should be the same as in the main table in Excel.
  • The VLOOKUP function works from left to right, not from right to left.
  • In the LOOKUP function, we need to select the result column and need not mention the column index number, unlike VLOOKUP.

Recommended Articles

This article is a guide to the LOOKUP Table in Excel. We discuss creating a LOOKUP table in Excel using VLOOKUP, INDEX, MATCH formulas, practical examples, and a downloadable Excel template. You may also learn more about Excel from the following articles: –

  • LOOKUP Formula ExcelThe LOOKUP excel function searches a value in a range (single row or single column) and returns a corresponding match from the same position of another range (single row or single column). The corresponding match is a piece of information associated with the value being searched.
    read more
  • VLOOKUP from Another SheetVlookup is a function that can be used to refer to columns on the same sheet or from another worksheet or workbook. A different workbook or worksheet is used to select the table array and index number.read more
  • What are the Alternatives to Vlookup?To reference data in columns from right to left, we can combine the index and match functions, which is one of the best Excel alternatives to Vlookup.read more
  • How to Fix VLOOKUP Errors?The top four VLOOKUP errors are — #N/A Error, #NAME? Error, #REF! Error, #VALUE! Error.read more

VLOOKUP Function – Introduction

VLOOKUP function is THE benchmark.

You know something in Excel if you know how to use the VLOOKUP function.

If you don’t, you better not list Excel as one of your strong areas in your resume.

I have been a part of the panel interviews where as soon as the candidate mentioned Excel as his area of expertise, the first thing asked was – you got it – the VLOOKUP function.

Now that we know how important this Excel function is, it makes sense to ace it completely to be able to proudly say – “I know a thing or two in Excel”.

This is going to be a massive VLOOKUP tutorial (by my standards).

I’ll cover everything there is to know about it, and then show you useful and practical VLOOKUP examples.

So buckle up.

It’s time for the takeoff.

An Introduction to Vlookup Function

When to use the VLOOKUP Function in Excel?

VLOOKUP function is best suited for situations when you are looking for a matching data point in a column, and when the matching data point is found, you go to the right in that row and fetch a value from a cell which is a specified number of columns to the right.

Let’s take a simple example here to understand when to use Vlookup in Excel.

Remember when the exam score list was out and pasted on the notice board and everyone used to go crazy finding their names and their score (at least that’s what used to happen when I was in school).

Here is how it worked:

  • You go up to the notice board and start looking for your name or enrolment number (running your finger from top to bottom in the list).
  • As soon as you spot your name, you move your eyes to the right of the name/enrolment number to see your scores.

And that is exactly what the Excel VLOOKUP function does for you (feel free to use this example in your next interview).

VLOOKUP function looks for a specified value in a column (in the above example, it was your name) and when it finds the specified match, it returns a value in the same row (the marks you obtained).

Syntax

=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])

Input Arguments

  • lookup_value – this is the look-up value you are trying to find in the left-most column of a table. It could be a value, a cell reference, or a text string. In the score sheet example, this would be your name.
  • table_array – this is the table array in which you are looking for the value. This could be a reference to a range of cells or a named range. In the score sheet example, this would be the entire table that contains score for everyone for every subject
  • col_index – this is the column index number from which you want to fetch the matching value. In the score sheet example, if you want the scores for Math (which is the first column in a table that contains the scores), you’d look in column 1. If you want the scores for Physics, you’d look in column 2.
  • [range_lookup] – here you specify whether you want an exact match or an approximate match. If omitted, it defaults to TRUE – approximate match (see additional notes below).

Additional Notes (Boring, but important to know)

  • The match could be exact (FALSE or 0 in range_lookup) or approximate (TRUE or 1).
  • In approximate lookup, make sure that the list is sorted in ascending order (top to bottom), or else the result could be inaccurate.
  • When range_lookup is TRUE (approximate lookup) and data is sorted in ascending order:
    • If the VLOOKUP function can not find the value, it returns the largest value, which is less than the lookup_value.
    • It returns a #N/A error if the lookup_value is smaller than the smallest value.
    • If lookup_value is text, wildcard characters can be used (refer to the example below).

Now, hoping that you have a basic understanding of what the VLOOKUP function can do, let’s peel this onion and see some practical examples of the VLOOKUP function.

10 Excel VLOOKUP Examples (Basic & Advanced)

Here are 10 useful exampels of using Excel Vlookup that will show you how to use it in your day-to-day work.

Example 1 – Finding Brad’s Math Score

In the VLOOKUP example below, I have a list wth student names in the left-most column and marks in different subjects in columns B to E.

VLOOKUP Examples - Dataset to find brad's marks using the VLOOKUP function

Now let’s get to work and use the VLOOKUP function for what it does best. From the above data, I need to know how much Brad scored in Math.

From the above data, I need to know how much Brad scored in Math.

Here is the VLOOKUP formula that will return Brad’s Math score:

=VLOOKUP("Brad",$A$3:$E$10,2,0)

The above formula has four arguments:

  • “Brad: – this is the lookup value.
  • $A$3:$E$10 – this is the range of cells in which we are looking. Remember that Excel looks for the lookup value in the left-most column. In this example, it would look for the name Brad in A3:A10 (which is the left-most column of the specified array).
  • 2 – Once the function spots Brad’s name, it will go to the second column of the array, and return the value in the same row as that of Brad. The value 2 here indicated that we are looking for the score from the second column of the specified array.
  • 0 – this tells the VLOOKUP function to only look for exact matches.

Here is how the VLOOKUP formula works in the above example.

First, it looks for the value Brad in the left-most column. It goes from top to bottom and finds the value in cell A6.

VLOOKUP function scans the list from top to bottom

As soon as it finds the value, it goes to the right in the second column and fetches the value in it.

Once the match is found, VLOOKUP goes to the right to the specified column

You can use the same formula construct to get anyone’s marks in any of the subjects.

For example, to find Maria’s marks in Chemistry, use the following VLOOKUP formula:

=VLOOKUP("Maria",$A$3:$E$10,4,0)

Excel Vlookup Example 1a Maria Chemistry

In the above example, the lookup value (student’s name) is entered in double quotes. You can also use a cell reference that contains the lookup value.

The benefit of using a cell reference is that it makes the formula dynamic.

For example, if you have a cell with a student’s name, and you are fetching the score for Math, the result would automatically update when you change the student’s name (as shown below):

VLOOKUP example showing how to use the function with drop-downs

If you enter a lookup value that is not found in the left-most column, it returns a #N/A error.

Example 2 – Two-Way Lookup

In Example 1 above, we hard-coded the column value. Hence, the formula would always return the score for Math as we have used 2 as the column index number.

But what if you want to make both the VLOOKUP value and the column index number dynamic. For example, as shown below, you can change either the student name or the subject name, and the VLOOKUP formula fetches the correct score. This is an example of a two-way VLOOKUP formula.

This is an example of a two-way VLOOKUP function.

VLOOKUP Examples - Two Way Lookup in Excel

To make this two-way lookup formula, you need to make the column dynamic as well. So when a user changes the subject, the formula automatically picks the correct column (2 in the case of Math, 3 in the case of Physics, as so on..).

To do this, you need to use the MATCH function as the column argument.

Here is the VLOOKUP formula that will do this:

=VLOOKUP(G4,$A$3:$E$10,MATCH(H3,$A$2:$E$2,0),0)

The above formula uses MATCH(H3,$A$2:$E$2,0) as the column number. MATCH function takes the subject name as the lookup value (in H3) and returns its position in A2:E2. Hence, if you use Math, it would return 2 as Math is found in B2 (which is the second cell in the specified array range).

Example 3 – Using Drop Down Lists as Lookup Values

In the above example, we have to manually enter the data. That could be time-consuming and error-prone, especially if you have a huge list of lookup values.

A good idea in such cases is to create a drop-down list of the lookup values (in this case, it could be student names and subjects) and then simply choose from the list.

Based on the selection, the formula would automatically update the result.

Something as shown below:

Using Drop Down List as Lookup Values

This makes a good dashboard component as you can have a huge data set with hundreds of students at the back end, but the end user (let’s say a teacher) can quickly get the marks of a student in a subject by simply making the selections from the drop down.

How to make this:

The VLOOKUP formula used in this case is the same used in Example 2.

=VLOOKUP(G4,$A$3:$E$10,MATCH(H3,$A$2:$E$2,0),0)

The lookup values have been converted into drop-down lists.

Here are the steps to create the drop down list:

  • Select the cell in which you want the drop-down list. In this example, in G4, we want the student names.
  • Go to Data –> Data Tools –> Data Validation.
  • In the Data Validation Dialogue box, within the settings tab, select List from the Allow drop-down.
  • In the source, select $A$3:$A$10
  • Click OK.

Now you’ll have the drop-down list in cell G4. Similarly, you can create one in H3 for the subjects.

Example 4 – Three-way Lookup

What is a three-way lookup?

In Example 2, we’ve used one lookup table with scores for students in different subjects. This is an example of a two-way lookup as we use two variables to fetch the score (student’s name and the subject’s name).

Now, suppose in a year, a student has three different levels of exams, Unit Test, Midterm, and Final Examination (that’s what I had when I was a student).

A three-way lookup would be the ability to get a student’s marks for a specified subject from the specified level of exam.

Something as shown below:

An example of doing 3 way lookup using VLOOKUP function

In the above example, the VLOOKUP function can lookup in three different tables (Unit Test, Midterm, and Final Exam) and returns the score for the specified student in the specified subject.

Here is the formula used in cell H4:

=VLOOKUP(G4,CHOOSE(IF(H2="Unit Test",1,IF(H2="Midterm",2,3)),$A$3:$E$7,$A$11:$E$15,$A$19:$E$23),MATCH(H3,$A$2:$E$2,0),0) 

This formula uses the CHOOSE function to make sure the right table is referred to. Let’s analyze the CHOOSE part of the formula:

CHOOSE(IF(H2=”Unit Test”,1,IF(H2=”Midterm”,2,3)),$A$3:$E$7,$A$11:$E$15,$A$19:$E$23)

The first argument of the formula is IF(H2=”Unit Test”,1,IF(H2=”Midterm”,2,3)), which checks the cell H2 and see what level of exam is being referred to. If it’s Unit Test, it returns $A$3:$E$7, which has the scores for Unit Test. If it’s Midterm, it returns $A$11:$E$15, else it returns $A$19:$E$23.

Doing this makes the VLOOKUP table array dynamic and hence makes it a three-way lookup.

Example 5 – Getting the Last Value from a List

You can create a VLOOKUP formula to get the last numerical value from a list.

The largest positive number that you can use in Excel is 9.99999999999999E+307This also means that the largest lookup number in the VLOOKUP number is also the same.

I don’t think you would ever need any calculation involving such a large number. And that is exactly what we can use get the last number in a list.

Suppose you have a dataset (in A1:A14) as shown below and you want to get the last number in the list.

Finding the last value from a list using VLOOKUP function in Excel

Here is the formula you can use:

=VLOOKUP(9.99999999999999E+307,$A$1:$A$14,TRUE)

Note that the formula above uses an approximate match VLOOKUP (notice TRUE at the end of the formula, instead of FALSE or 0). Also, note that the list doesn’t need to be sorted for this VLOOKUP formula to work.

Here is how the approximate VLOOKUP function works. It scans the left most column from top to bottom.

  • If it finds an exact match, it returns that value.
  • If it finds a value that is higher than the lookup value, it returns the value in the cell above it.
  • If the lookup value is greater than all the values in the list, it returns the last value.

In the above example, the third scenario is at work.

Since 9.99999999999999E+307 is the largest number that can be used in Excel, when this is used as the lookup value, it returns the last number from the list.

In the same way, you can also use it to return the last text item from the list. Here is the formula that can do that:

=VLOOKUP("zzz",$A$1:$A$8,1,TRUE)

Excel Vlookup Example last value name

The same logic follows. Excel looks through all the names, and since zzz is considered bigger than any name/text starting with alphabets before zzz, it would return the last item from the list.

Example 6 – Partial Lookup using Wildcard Characters and VLOOKUP

Excel wildcard characters can be really helpful in many situations.

It’s that magic potion that gives your formulas super powers.

Partial look-up is needed when you have to look for a value in a list and there isn’t an exact match.

For example, suppose you have a data set as shown below, and you want to look for the company ABC in a list, but the list has ABC Ltd instead of ABC.

Wildcard Characters in Excel - Partial Lookup

You can not use ABC as the lookup value as there is no exact match in column A. Approximate match also leads to erroneous results and it requires the list to be sorted in an ascending order.

However, you can use a wildcard character within the VLOOKUP function to get the match.

Enter the following formula in cell D2 and drag it to the other cells:

=VLOOKUP("*"&C2&"*",$A$2:$A$8,1,FALSE)

Using VLOOKUP with wildcard characters to find partial matches

How does this formula work?

In the above formula, instead of using the lookup value as is, it is flanked on both sides with the wildcard character asterisk (*) – “*”&C2&”*”

An asterisk is a wildcard character in Excel and can represent any number of characters.

Using the asterisk on both sides of the lookup value tells Excel that it needs to look for any text that contains the word in C2. It could have any number of characters before or after the text in C2.

For example, cell C2 has ABC, so the VLOOKUP function looks through the names in A2:A8 and searches for ABC. It finds a match in cell A2, as it contains ABC in ABC Ltd. It doesn’t matter if there are any characters to the left or right of ABC. Until there is ABC in a text string, it will be considered a match.

Note: VLOOKUP function always returns the first matching value and stops looking further. So if you have ABC Ltd., and ABC Corporation in a list, it will return the first one and ignore the rest.

Example 7 – VLOOKUP Returning an Error Despite a Match in Lookup Value

It can drive you crazy when you see that there is a matching lookup value and the VLOOKUP function is returning an error.

For example, in the below case, there is a match (Matt), but the VLOOKUP function still returns an error.

Example where extra spaces lead to error when VLOOKUP is used

Now while we can see there is a match, what we can not see with a naked eye is that there could be leading or trailing spaces. If you have these additional spaces before, after, or in between the lookup values, it ISN’T an exact match.

This is often the case when you import data from a database or get it from someone else. These leading/trailing spaces have a tendency to sneak in.

The solution here is the TRIM function. It removes any leading or trailing spaces or extra spaces between words.

Here is the formula that’ll give you the right result.

=VLOOKUP("Matt",TRIM($A$2:$A$9),1,0)

Since this is an array formula, use Control + Shift + Enter instead of just Enter.

Another way could be to first treat your lookup array with the TRIM function to make sure all the additional spaces are gone, and then use the VLOOKUP function as usual.

Example 8 – Doing a Case Sensitive Lookup

By default, the lookup value in the VLOOKUP function is not case sensitive. For example, if your lookup value is MATT, matt, or Matt, it’s all the same for the VLOOKUP function. It’ll return the first matching value irrespective of the case.

But if you want to do a case-sensitive lookup, you need to use the EXACT function along with the VLOOKUP function.

Here is an example:

Doing a case sensitive lookup

As you can see, there are three cells with the same name (in A2, A4, and A5) but with a different alphabet case.  On the right, we have the three names (Matt, MATT, and matt) along with their scores in Math.

Now the VLOOKUP function is not equipped to handle case-sensitive lookup values. In this above example, it would always return 38, which is the score for Matt in A2.

To make it case sensitive, we need to use a helper column (as shown below):

Excel Vlookup Example - Case Sensitive Helper row

To get the values in the helper column, use the =ROW() function. It will simply get the row number in the cell.

Once you have the helper column, here is the formula that will give the case-sensitive lookup result.

=VLOOKUP(MAX(EXACT(E2,$A$2:$A$9)*(ROW($A$2:$A$9))),$B$2:$C$9,2,0)

Now let’s break down and understand what this does:

  • EXACT(E2,$A$2:$A$9) – This part would compare the lookup value in E2 with all the values in A2:A9. It returns an array of TRUEs/FALSEs where TRUE is returned where there is an exact match. In this case, it would return the following array: {TRUE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE}.
  • EXACT(E2,$A$2:$A$9)*(ROW($A$2:$A$9) – This part multiplies the array of TRUEs/FALSEs with the row number. Wherever there is a TRUE, it gives the row number, else it gives 0. In this case, it would return {2;0;0;0;0;0;0;0}.
  • MAX(EXACT(E2,$A$2:$A$9)*(ROW($A$2:$A$9))) – This part returns the maximum value from the array of numbers. In this case, it would return 2 (which is the row number where there is an exact match).
  • Now we simply use this number as the lookup value and use the lookup array as B2:C9

Note: Since this is an array formula, use Control + Shift + Enter instead of just enter.

Example 9 – Using VLOOKUP with Multiple Criteria

Excel VLOOKUP function, in its basic form, can look for one lookup value and return the corresponding value from the specified row.

But often there is a need to use VLOOKUP in Excel with multiple criteria.

Suppose you have a data with students name, exam type, and the Math score (as shown below):

Excel Vlookup Example - second lookup

Using the VLOOKUP function to get the Math score for each student for respective exam levels could be a challenge.

For example, if you try using VLOOKUP with Matt as the lookup value, it’ll always return 91, which is the score for the first occurrence of Matt in the list. To get the score for Matt for each exam type (Unit Test, Mid Term and Final), you need to create a unique lookup value.

This can be done using the helper column. The first step is to insert a helper column to the left of the scores.

Excel Vlookup Example - second lookup helper

Now, to create a unique qualifier for each instance of the name, use the following formula in C2: =A2&”|”&B2

Copy this formula to all the cells in the helper column. This will create unique lookup values for each instance of a name (as shown below):

Excel VLOOKUP-function Examples Helper

Now, while there were repetitions of the names, there is no repetition when the name is combined with the level of examination.

This makes it easy as now you can use the helper column values as the lookup values.

Here is the formula that’ll give you the result in G3:I8.

=VLOOKUP($F3&"|"&G$2,$C$2:$D$19,2,0)

Here we have combined the student name and the level of examination to get the lookup value, and we use this lookup value and checks it in the helper column to get the matching record.

Excel VLOOKUP function Examples Formula Unique Lookup

Note: In the above example, we have used | as the separator while joining text in the helper column. In some exceptionally rare (but possible) conditions, you may have two criteria that are different but ends up giving the same result when combined. Here is an example:

VLOOKUP with Multiple Criteria - Why separator

Note that while A2 and A3 are different and B2 and B3 are different, the combinations end up being the same. But if you use a separator, then even the combination would be different (D2 and D3).

Here is a tutorial on how to use VLOOKUP with multiple criteria without using helper columns. You can also watch my video tutorial here.

Example 10 – Handling Errors while Using the VLOOKUP Function

Excel VLOOKUP function returns an error when it can not find the specified lookup value. You may not want the ugly error value disturbing the aesthetics of your data in case VLOOKUP can’t find a value.

You can easily remove the error values with any meaning full text such as “Not Available” or “Not Found”.

For example, in the example below, when you try to find the score of Brad in the list, it returns an error as Brad’s name is not there in the list.

Excel Vlookup Example - handling error

To remove this error and replace it with something meaningful, wrap your VLOOKUP function within the IFERROR function.

Here is the formula:

=IFERROR(VLOOKUP(D2,$A$2:$B$7,2,0),"Not Found")

The IFERROR function checks if the value returned by the first argument (which is the VLOOKUP function in this case) is an error or not. If it’s not an error, it returns the value by the VLOOKUP function, else it returns Not Found.

Excel Vlookup Example - handling error not found

IFERROR function is available from Excel 2007 onwards. If you are using versions prior to that, use the following function:

=IF(ISERROR(VLOOKUP(D2,$A$2:$B$7,2,0)),"Not Found",VLOOKUP(D2,$A$2:$B$7,2,0))

Also See: How to handle VLOOKUP Errors in Excel.

That’s it in this VLOOKUP tutorial.

I’ve tried to cover major examples of using the Vlookup function in Excel. If you would like to see more examples added to this list, let me know in the comments section.

Note: I’ve tried my best to proofread this tutorial, but in case you find any errors or spelling mistakes, please let me know 🙂

Using VLOOKUP Function in Excel – Video

Related Excel Functions:

  • Excel HLOOKUP Function.
  • Excel XLOOKUP Function
  • Excel INDEX Function.
  • Excel INDIRECT Function.
  • Excel MATCH Function.
  • Excel OFFSET Function.

You May Also Like the Following Excel Tutorials:

  • VLOOKUP Vs. INDEX/MATCH – The Debate ends here.
  • Excel Index Match Examples
  • How to Make VLOOKUP Function Case Sensitive.
  • Get Multiple Lookup Values Without Repetition in a Single Cell
  • Avoid Nested IF Function in Excel by using VLOOKUP

Like this post? Please share to your friends:
  • Vlookup vba excel описание
  • Vlookup not found excel
  • Vlookup function for excel
  • Vlookup excel что это такое
  • Vlookup excel функция как работает