+ Reply to Thread
Results 1 to 4 of 4

Using indirect (?) within table to create dynamic formulas

  1. #1
    Registered User
    Join Date
    11-13-2010
    Location
    Wilsonville, OR
    MS-Off Ver
    Excel 2007
    Posts
    5

    Using indirect (?) within table to create dynamic formulas

    Hi all,

    I'm using Excel 2010, and I'm having a problem within a table that I believe can be solved by using indirect(), but I can't quite figure it out. I have one master table (Table1 in the attachment) that feeds a pivot table. Table1 tracks the performance of several different revenue streams over many weeks, as well as budget vs actual. Table1 is fed by several smaller tables (eg Table3 and Table4). Because data comes into Table3 and Table4 via different sources, the formats of Table3 and Table4 are different. The problem, then, is getting the data into a uniform source so that the performance of each revenue stream can be tracked in one location, Table1. My way to fix this is to write a formula for D4:D7 that would look at the Revenue Stream in column C and evaluate the corresponding formula from Table2. In other words, D4:D5 are related to the "Catalog" revenue stream, so the formula that D4:D5 would evaluate is in G4: =VLOOKUP([@Week],Table3[#All],2,FALSE). D6:D7 are related to the "Promotion" revenue stream, so the formula to evaluate is in G6: =SUMIF(Table4[Week],[@Week],Table4[Revenue]). I'm thinking the format would be do a vlookup for the value in column C, the lookup array would be Table2, the column would be 2, and somehow indirect() would turn the string into a usable formula.

    A couple additional thoughts:

    -I don't want to use nested if statements as in: if (Rev Stream = Catalog,VLOOKUP([@Week],Table3[#All],2,FALSE),if(Rev Stream = Promotion ... etc. because there are several more revenue streams; the nested if statement would be incredibly cumbersome.
    -In this example, Table3 and Table4 are very similar in format, but the actual workbook has a great variety in the individual table formats. Making one uniform format among Table 3, Table 4, etc is not possible.

    Thanks in advance for your thoughts.
    Cory

    Indirect.xlsx

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Using indirect (?) within table to create dynamic formulas

    I know you said you didnt want nested IF()'s, but unless you have some way to ID which table to use, how else would you do that?

    This is what I have so far...
    =IF(Table1[[#This Row],[Rev Stream]]="Catalog",INDEX(Table3[[#All],[Revenue]],MATCH(B4,Table3[[#All],[Week]],0),1),INDEX(Table4[[#All],[Revenue]],MATCH(B4,Table4[[#All],[Week]],0),1))

    If you have a table that says Catalog = table3, Promotion = table4, how else would you know which table to use?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Using indirect (?) within table to create dynamic formulas

    OK try this. I created a small table in C13:D14 with
    Catalog......table3
    Promotion...table4

    Then used this in D4 (it copied down)...
    =INDEX(INDIRECT(VLOOKUP(C4,$C$13:$D$14,2)&"[[#All],[Revenue]]"),MATCH(B4,INDIRECT( VLOOKUP(C4,$C$13:$D$14,2)&"[[#All],[Week]]"),0),1)

  4. #4
    Registered User
    Join Date
    11-13-2010
    Location
    Wilsonville, OR
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Using indirect (?) within table to create dynamic formulas

    Thanks for your quick input; this is a great start! The catalog revenue stream will always correspond to Table3, promotion will always correspond to Table4. I didn't clarify that piece well, but you could rename "Table3" to "Catalog" and "Table4" to "Promotion" to bypass the need for that first vlookup. Also, the index() and match() approach doesn't quite work because there are multiple values in the Promotion table (ie Table4) that need to be summed as the Week 1 total. The week 1 promotion total should be 20+50=70; the week 2 promotion total should be 35+30=65. This is why I feel I need Table2: because the calculation to return the correct revenue total for the week is so varied amongst the different revenue streams.

    Thanks again for your input.

    Edit: this doesn't quite solve my problem.
    Last edited by cotoews; 08-31-2013 at 02:59 PM.

+ 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. Using indirect to create modifiable formulas that link multiple worksheets?
    By linesout in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-01-2013, 12:27 PM
  2. [SOLVED] Create a Dynamic Chart from an Excel Table
    By Elīna in forum Excel Charting & Pivots
    Replies: 8
    Last Post: 07-29-2013, 12:45 PM
  3. need to create a dynamic table
    By Froggie01 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 02-10-2013, 08:32 PM
  4. Make Table Names in Formulas Dynamic
    By bbailey19087 in forum Excel General
    Replies: 1
    Last Post: 09-21-2011, 05:57 PM
  5. Can you create dynamic named ranges containing array formulas?
    By Marie J-son in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-28-2006, 09:10 AM

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