Dynamic Vlookup Function Explained


You are asked to update a table wherein VLOOKUP function needs to be entered in hundreds of columns. It is not possible to change the formula manually in hundreds of columns to update the column index number (third parameter of Vlookup function).

Semi Dynamic Vlookup Formula

Look at the image below. We need to change the formula in each cell (C11 through E11) to update the third parameter of Vlookup formula (col_index_num).

Use the COLUMN function to increment column index number automatically by 1

How COLUMN function works?

It returns the column number of a cell reference.

For example, the formula =COLUMN(B1) returns 2, because column B is the second column.

After applying the formula in cell C11, paste the formula to the right (Select the cells C11 through C13 and press CTRL + R).

Dynamic Vlookup Formula

Suppose columns are not ordered in the table the way you want values to be returned.

Since the column index numbers are not in any proper order, we cannot use COLUMN function.
Instead we can use MATCH function to return the column index number.

How MATCH function works?

The MATCH function returns the relative position of an item in an array that matches a specified value.
= MATCH(value to be found, range of cells being searched, match type)

After applying the formula in cell C11, paste the formula to the right (Select the cells C11 through C13 and press CTRL + R).
= MATCH (C10, $B$2:$E2,0) evaluates to :
= MATCH("Last Name", ("First Name","Last Name","Class","Sections"), Find the closest match)
Result : It returns 2 as "Last Name" is placed second in list.

Download the workbook 
ListenData Logo
Spread the Word!
Related Posts
About Author:
Deepanshu Bhalla

Deepanshu founded ListenData with a simple objective - Make analytics easy to understand and follow. He has over 10 years of experience in data science. During his tenure, he has worked with global clients in various domains like Banking, Insurance, Private Equity, Telecom and Human Resource.

1 Response to "Dynamic Vlookup Function Explained"
  1. SIR please provide excel pivot table creation with examples and v look up sir


Next → ← Prev
Looks like you are using an ad blocker!

To continue reading you need to turnoff adblocker and refresh the page. We rely on advertising to help fund our site. Please whitelist us if you enjoy our content.