Get instant live expert help with Excel or Google Sheets
“My Excelchat expert helped me in less than 20 minutes, saving me what would have been 5 hours of work!”

Post your problem and you’ll get expert help in seconds.

Your message must be at least 40 characters
Our professional experts are available now. Your privacy is guaranteed.
All articles VLOOKUP Nested VLOOKUP Formula Examples

Nested VLOOKUP Formula Examples

While working in VLOOKUP function in Excel, we may need to look up for values in multiple tables. This is possible by nesting VLOOKUP function. In this tutorial, we will learn how to nest VLOOKUP function in order to look up for a value.

Setting up Your Data

Figure 1. Tables for nested VLOOKUP

We will now look at the example to explain in details how this function works. Above all, let’s start with examining the structure of the data that we will use.

The Table 1 consists of 2 columns:

  • The first column is “Product” (B)
  • The second one is “Salesman” (C).

The second table, Table 2, consists of 3 columns:

  • Column E is “Salesman”,
  • Column F is “Sales”
  • While column G is “Product”.

Finally, Table 3 has 2 columns:

  • Column I is “Product”
  • Column J is “Sales”.

As a result, we want to get sales value in the third table (column J), depending on a product (column I).

Syntax of the VLOOKUP formula

If we want to pull the data from another table we can use VLOOKUP function. The generic formula syntax for VLOOKUP is:

=VLOOKUP(lookup_value, table_array, col_index_num, range_lookup)

The parameters of the VLOOKUP function are:

  • Lookup_value– a value which we want to find in a lookup table
  • Table_array– a table in which we want to look up
  • Col_index_num– a column number in a lookup table from which we want to pull the data
  • Range_lookup– default value 0. This means that we want to find an exact match for a lookup value.

If we try to use VLOOKUP function as in the example below, an error will appear. In VLOOKUP function table_array must be on the left side of the column from which we want to extract the data.

=VLOOKUP(I3,$F$3:$G$7,2,0)

Figure 2. Single VLOOKUP not working

Since single VLOOKUP function is not working, we will have to use nested VLOOKUP function:

=VLOOKUP(VLOOKUP(lookup_value1, table_array1, col_index_num1, range_lookup),table_array2, col_index_num2, range_lookup)

The nested VLOOKUP allows us to get value from a lookup table, even when we don’t have a direct relation to the main table. Therefore, we will use the second table which has a connection with both tables.

Get the Sales Values Using Nested VLOOKUP

As we can see in the picture, we don’t have a direct connection between “Product” and “Sales” columns in Table 2.In order to use VLOOKUP, the lookup column must be the leftmost.

Because of this, we will have to follow the next steps:

  • First to find “Salesman” from Table 1.
  • After that, we will lookup for “Sales” in Table 2 with “Salesman” from Table 1.

Figure 3. Nested VLOOKUP formula examples

The formula looks like:

=VLOOKUP(VLOOKUP(I3,$B$3:$C$7,2,0),$E$3:$G$7,2,0)

In our example, lookup_value of the main VLOOKUP is nested VLOOKUP. We will first explain nested VLOOKUP formula part. The goal is to obtain Salesman name from the Tabel 1 who sells Product A.

Formula parts for the nested VLOOKUP will look like:

  • Lookup_value “Product A” (cell I3)
  • table_array – the first table  ($B$3:$C$7)
  • col_index_num2has value 2, as we want to pull value from the second column of the range
  • range_lookuphas value 0, because we want to find an exact match of “Salesman” values

The result of this “inner” VLOOKUP will be “John” from cell C3 of the Table 1. This value will be lookup_value for the main VLOOKUP since we want to find Sales value for John in the second table.

Formula explanation for the first VLOOKUP:

  • Lookup_valuenested VLOOKUP result (John)
  • table_array – the second table ($E$3:$G$7)
  • col_index_num2has value 2, as we want to pull value from the second column of the range
  • range_lookuphas value 0, because we want to find an exact match of “Sales” values

To use nested VLOOKUP, we need to follow these steps:

  • Select cell J3 and click on it
  • Insert the formula: =VLOOKUP(VLOOKUP(I3,$B$3:$C$7,2,0),$E$3:$G$7,2,0)
  • Press enter
  • Drag the formula down to the other cells in the column by clicking and dragging the little “+” icon at the bottom-right of the cell.=

As a result, we will get sales $500 in the cell J3. As we can see, the value of “Salesman” for “Product A” in Table 1 is John. Therefore, the “Sales” for John in Table 2 will be $500. Finally, the VLOOKUP will return $500 in the cell B3 for “Product A”.

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.

Are you still looking for help with the VLOOKUP function? View our comprehensive round-up of VLOOKUP function tutorials here.

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:
Solution examples
I have a pivot table in which per order (on the rows) stands how much products they ordered per size (on the columns). I want to determine which combinations of quantities of sizes people order. And I want to count these combinations.
Solved by E. W. in 60 mins
I have 500 numbers in column A with aproximatly 15digits. In column B I have 5 numbers with 6 digits Can a find a formula wich can transfer all numbers from A column wich start with some 6 digitsa from B column
Solved by V. L. in 32 mins
I have a sheet with 3 columns. First column is a code for records in column B (has 563 records). What I need is a formula to show me if what is in column C (has 4400 records) is in column B and if it is to take the code for that record. Example: Column A(code corresponding to column B): 12, 14, 15, 19 Column B(names): asd, adf, ade, aqw Column C(names): akd, adf, ade, anb, wgs I need something that would say, if record in column C (for example adf) is matching record in column B (adf) return the code from column A (the code corresponding to that record in column B),if not return blank.
Solved by C. J. in 8 mins
If the data in A matches the data in C, then I need the data in E to be placed in B
Solved by X. W. in 40 mins
I have a workbook with 2 sheets. First sheet has column A which is a device name, then columns B - infinity that have numeric "tags" for that device. Each device can have one or 20 "tags", tags are all numerical. Worksheet 2 has column A which is numeric value and B which is a human readable value of what the tag is. Question is, how do I replace all the tag numbers in worksheet 1 with the actual human readable values is sheet 2?
Solved by T. H. in 16 mins

Leave a Comment

avatar

Subscribe to Excelchat.co

Get updates on helpful Excel topics

Subscribe to Excelchat.co

Did this post not answer your question?
Get a solution from connecting with the expert

Another blog reader asked this question today on Excelchat:

Post your problem and you’ll get expert help in seconds.

Your message must be at least 40 characters
Our professional experts are available now. Your privacy is guaranteed.
Trusted by people who work at
Amazon.com, Inc
Facebook, Inc
Accenture PLC
Siemens AG
Macy's
The Allstate Corporation
United Parcel Service
Dell Inc