+ Reply to Thread
Results 1 to 8 of 8

Incorporate Looking Up Appropriate Table, from a list of Tables, within a Macro

  1. #1
    Forum Contributor
    Join Date
    08-08-2015
    Location
    NJ
    MS-Off Ver
    2013
    Posts
    205

    Incorporate Looking Up Appropriate Table, from a list of Tables, within a Macro

    Hello, looking for a solution within a macro that could be incorporated into an Index/Match formula. My challenge is, I run reports for varied groups, that have different "guidance" information, so my lookup for particular guidance information is dependent on the group for which I am running the report.

    In the attached, I have built in Index/Match formulas in columns BT and BU, and the formula could be looking up one of three tables on the "Guidance Look Up" tab. Is it possible to build into a macro, perhaps a message box (or anything of the like, a find/replace, etc.), that could help choose the appropriate table to incorporate into the Index/Match formulas in columns BT and BU?

    Thanks for any input!
    Sheryl
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,856

    Re: Incorporate Looking Up Appropriate Table, from a list of Tables, within a Macro

    Is it necessary to use a macro? I would probably just use two MATCH() functions with the INDEX() function:

    1) One MATCH(), just like you are currently using to return row number, that finds the row number. I note that the leftmost column of each "table" is the same, so it may be adequate to simply search the first column of the table independent of which table the return value needs to come from. =MATCH($BS71,'Guidance Look Up'!$A$2:$A$10,0)
    2) A second MATCH() function could then find the leftmost column # of each lookup table. =MATCH("communications",'Guidance Look Up'!$A$1:$K$1,0) [or enter communications into a cell and reference that cell]. Note that the return column for low% will be 1 column more than the result of this match and the high% column will be 2 more.
    3) Then an INDEX() function referencing all of the lookup tables to return the desired value. INDEX('Guidance Look Up'!$A$2:$K$10,result_of_1, result_of_2 +1) to get the low% result. INDEX(...,...,...+2) to get the high% result.

    No macros needed. Is that something you can work with, or is there more to this?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Contributor
    Join Date
    08-08-2015
    Location
    NJ
    MS-Off Ver
    2013
    Posts
    205

    Re: Incorporate Looking Up Appropriate Table, from a list of Tables, within a Macro

    Thank you for the quick response. This is another way to go, my challenge is, I am looking for an automated way to update those formulas, which is why I was thinking of incorporating within a macro I already have (not part of the attached). I run this type of report for about seven different groups, meaning there will be about seven different tables, so depending on the group (such as "Communications", "CIO", etc.) I run for, that is how the formula should update. I am trying to avoid manually updating with each report run since these are run at a high volume.

    Hope that made sense. Any thoughts? Thanks again.

    Sheryl

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,856

    Re: Incorporate Looking Up Appropriate Table, from a list of Tables, within a Macro

    I am looking for an automated way to update those formulas
    I am not sure I understand what you mean. If calculation is set to automatic, then these formulas should update automatically whenever the data is entered/changed/updated. If you put your group name into a cell ("communication") and correctly reference that cell in the step 2 MATCH() formula, then changing the group should be as easy as entering/editing the text in that cell (a data validation drop down list might be valuable here). Updates should be automatic and the only interaction with the sheet should be entering the text in that cell (and any other inputs that your current example does not illustrate).

    I think that we may need to better understand how you are interacting and/or want to interact with this spreadsheet and how these lookup functions fit into the overall project. A pivot table approach may be preferable (especially for long term database maintenance and management) or there may be other considerations.

  5. #5
    Forum Contributor
    Join Date
    08-08-2015
    Location
    NJ
    MS-Off Ver
    2013
    Posts
    205

    Re: Incorporate Looking Up Appropriate Table, from a list of Tables, within a Macro

    Yes, probably confusing. Appreciate you trying here for me. The way this works is I will run a high volume of reports and paste into an Excel template, such as the sample attached. From there, I press a button and lots of formatting and varied updates occur. Because of the high volume of reports run, I am trying to remove any manual intervention, which in this case, would be updating the formulas in BT:BU with each run. Does that help in terms of what I am trying to accomplish?

    Sheryl

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Incorporate Looking Up Appropriate Table, from a list of Tables, within a Macro

    Hi sherylt13

    Here's a different approach...notice the new Sheet "Lists". It contains a Dynamic Named Range called "Dept"...you can call it what ever you wish. It's used to populate the Drop Down in Cell BS3 of Sheet "RosterCurrentLast". Add as many items to it as you wish.

    This "Change Code" is in Sheet "RosterCurrentLast" Code Module. As Cell BS3 changes so does Data in Columns BT and BU.
    Please Login or Register  to view this content.
    Let me know of issues.
    Attached Files Attached Files
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  7. #7
    Forum Contributor
    Join Date
    08-08-2015
    Location
    NJ
    MS-Off Ver
    2013
    Posts
    205

    Re: Incorporate Looking Up Appropriate Table, from a list of Tables, within a Macro

    Thank you !!!!

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Incorporate Looking Up Appropriate Table, from a list of Tables, within a Macro

    You're welcome...glad I could help. Thanks for the Rep.

+ 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. Creating a Macro - Need to incorporate a Loop
    By jason4444 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-04-2016, 03:47 PM
  2. Incorporate SQL Query into Macro
    By lynnexcel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-08-2015, 12:54 PM
  3. Incorporate Loop Function In Recorded Macro
    By tarktran in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-07-2015, 05:57 AM
  4. How to create a list box, fill & incorporate into another macro
    By anrichards22 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-12-2013, 05:45 AM
  5. [SOLVED] Drop Down List to fill table from multiple tables
    By hidden78731 in forum Excel General
    Replies: 2
    Last Post: 05-10-2012, 12:12 PM
  6. Macro to create multiple tables from one table.
    By VivatJesus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-26-2011, 05:25 PM
  7. Incorporate an Excel Formula in to this Macro
    By BusDriver2 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-14-2009, 10:03 PM

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