WISDOMBYDATA
  • BLOG
    • Blog Guide
    • Blog History
  • EXCEL
    • Functions & Formulas
    • VBA & Macros
    • VLOOKUP
    • Pivot Tables
    • Conditional Formatting
    • Tricks & Shortcuts
  • BI
    • SAP BOBJ/BW
    • Tableau
  • SQL
  • ABOUT
    • About WBD
    • About Me

How to create a dynamic VLOOKUP in MS Excel

8/13/2016

0 Comments

 
​A Dynamic VLOOKUP could be useful for retrieving a select set of fields from multiple tables and/or worksheets. Consider the four tables below containing relevant data for four films: “Mimic”, “Pulp Fiction”, “Scream 2”, and “Spy Kids”. Say we want to write a formula that would retrieve the Director name for each film in a separate table. 

Picture
Here is the Procedure.
STEP 1] we start off by creating a dynamic table for each of the four tables. This is done by selecting the entire table for each table one at a time, and then typing the name of the particular table in the top left corner name box section. Here is how I did it for the first table (I.e. “Mimic”).
Picture
The same thing must be done for the remaining three tables (I.e. “PulpFiction”, “Scream2”, and “SpyKids” as well (IMPORTANT NOTE: No spaces allowed within the name box section).
​
STEP 2] make a new table containing three columns. First column displaying the name of the each table, second column displaying the particular role we want to search by (in this case the “Director”) and a third column is for the VLOOKUP calculation.
Picture
IMPORTANT NOTE: In order for the formula (explained in the following steps) to take effect, there must be no spaces in the film names. Either manually delete the spaces, or use the technique below to have it done very quickly:
Picture
​STEP 3] in the result Column input a formula similar to the one below:
=VLOOKUP(H3,INDIRECT(G3),2, FALSE)
 
​​How this formula works? 
This is a simple VLOOKUP but the only difference is that the INDIRECT syntax has been used in the table array part in order to fetch the relevant data from the dynamic tables. The INDIRECT syntax creates a reference from text (in this case from the “Mimic” text in cell G3) and returns a valid reference from that table.
Picture
STEP 4] apply the formula to all tables by dragging it down. Here is the final desired outcome.
Picture
To look for other unique categories (I.e. Producer, Screenwriter, and Editor) the respective value needs to be inputted in the role column (i.e. Column G).  
0 Comments

Your comment will be posted after it is approved.


Leave a Reply.

    Categories

    All
    BI
    EXCEL
    MISC
    SQL

    Archives

    June 2020
    May 2020
    April 2020
    March 2020
    February 2020
    December 2019
    November 2019
    October 2019
    September 2019
    August 2019
    July 2019
    June 2019
    May 2019
    April 2019
    March 2019
    February 2019
    January 2019
    December 2018
    November 2018
    October 2018
    September 2018
    August 2018
    July 2018
    June 2018
    May 2018
    April 2018
    March 2018
    September 2017
    August 2017
    July 2017
    June 2017
    May 2017
    April 2017
    March 2017
    February 2017
    January 2017
    December 2016
    November 2016
    October 2016
    September 2016
    August 2016
    July 2016
    June 2016
    May 2016
    April 2016
    March 2016
    February 2016
    May 2015
    April 2015
    March 2015
    February 2015
    January 2015
    December 2014
    November 2014
    October 2014
    September 2014
    August 2014
    April 2014
    March 2014
    February 2014
    January 2014
    December 2013
    November 2013

Powered by Create your own unique website with customizable templates.
  • BLOG
    • Blog Guide
    • Blog History
  • EXCEL
    • Functions & Formulas
    • VBA & Macros
    • VLOOKUP
    • Pivot Tables
    • Conditional Formatting
    • Tricks & Shortcuts
  • BI
    • SAP BOBJ/BW
    • Tableau
  • SQL
  • ABOUT
    • About WBD
    • About Me