+ Reply to Thread
Results 1 to 3 of 3

Index(Match()) dynamic formula - reffering to tables in the formula by cell values

  1. #1
    Registered User
    Join Date
    05-28-2017
    Location
    Aarhus, Denmark
    MS-Off Ver
    MS Office 2016
    Posts
    3

    Index(Match()) dynamic formula - reffering to tables in the formula by cell values

    Hello!

    This is my first thread on the forum.
    I'm working as an architectural engineer and I have been assigned to a task where I have to make +150 reports on some old ventilations aggregats.
    For that I would of course want to standardize and automate the proces, so I can gather all informations in one excel workbook (in case of changes in the standard text or calculations).
    The ventilationaggregats is placed on different schools, and therefore I have made a drop down list with the school names.
    Depending on which school you choose you get another drop down list with the relevant ventilation aggregats (=agg.) for that exact school.

    Each school have a table and these table are named equal to the drop down list of the schools.
    In the table for each school is rows equal to ventilationsaggregats on the schools, where the first coloumn contains the name of the agg. (the drop down listes for agg. is bound up to this coloumn for each table).
    The next coloumns contains the values for each agg. which I will have to use for some calculations and the standard text. These calculations I would like to change each time a new school and agg. is choosen.
    Each table contains a header for each information/value on the ventilationsaggregat and each table have the same headers.

    I first made the command in excel for a test. The formula in the cell where I wanted my value to be insterted is: INDEX(Schoolname[HEADER_VALUE], MATCH(agg.name, Schoolname[HEADER_AGG], 0))
    (Note: in the real formula it is a specific school and agg., but for simplicity I wrote it as a general formula here)
    It worked, but that command was also "static" and not "dynamic".
    I then tried to write this in VBA and make it dynamic by referring to the cell valus in the dropdown two drop down listes, so I, by these two cells values, could refer to the relevant tables for each school.

    When I run the formula I just get the N/A in the cell where I was supposed to get a value.
    The code looks like this:

    Please Login or Register  to view this content.
    What am I missing? I would really appreciate some help, because I can't figure it out or google an answer with this one.
    I'm not a programmer, I just use it a bit as a hobby and a working tool, so it's most likely pretty basic.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Index(Match()) dynamic formula - reffering to tables in the formula by cell values

    Not sure I follow your description. This is what I assume:

    cell_school is the name of the school and a table with the same name. The table you want to Index-Match.

    cell_agg is the value you want to match in column 1 of the cell_school table column 1 and return the value from column 2

    cell_value is the cell range you want to return the lookup result.


    Try something like this (not tested). Change the sheet name (red) of the sheet that contains the lookup tables.

    Please Login or Register  to view this content.
    You may find this link helpful to reference different parts of a table with VBA code.

    The VBA Guide To ListObject Excel Tables
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    05-28-2017
    Location
    Aarhus, Denmark
    MS-Off Ver
    MS Office 2016
    Posts
    3

    Re: Index(Match()) dynamic formula - reffering to tables in the formula by cell values

    You sir, have just solved my problem and spared me for a lot of time -Thank you, I really appreciate that you have taken your time to help me. :o)
    I just made a little adjustment by adding the header names instead of the column number, so the code will remain flawless even if I should add some extra columns to the tables.
    Please Login or Register  to view this content.
    Thanks for the link, I'm sure it will come in handy!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VLOOKUP/INDEX/MATCH Formula to look up value from two tables.
    By acsishere in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-09-2017, 04:03 AM
  2. [SOLVED] Dynamic Array for Index/Match formula
    By Fletch74 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-23-2016, 03:51 PM
  3. Replies: 9
    Last Post: 03-06-2016, 01:14 PM
  4. Formula to Index, Match, Rank, and Sort a Dynamic Range of Values
    By AustinLe in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-14-2014, 03:49 AM
  5. [SOLVED] dynamic index match formula to transpose values across rows and then down columns
    By Bananas212 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 03-30-2014, 03:07 PM
  6. Index Match Match Formula DOESN'T WORK WITH TABLES/TABLE NAMES ??
    By Underling in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-04-2014, 09:01 PM
  7. dynamic range for index/match formula
    By excellicious in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-29-2008, 07:41 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1