Dynamic Vlookup Function Explained

Situation

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 

Excel Tutorials : 100 Excel Tutorials

Get Free Email Updates :
*Please confirm your email address by clicking on the link sent to your Email*

Related Posts:

0 Response to "Dynamic Vlookup Function Explained"

Post a Comment

Next → ← Prev