+ Reply to Thread
Results 1 to 3 of 3

Dynamic SUM of multiple named tables (structured referencing)

  1. #1
    Registered User
    Join Date
    11-27-2015
    Location
    Sao Paulo, Brazil
    MS-Off Ver
    MS Office 365
    Posts
    42

    Question Dynamic SUM of multiple named tables (structured referencing)

    The sample schedule below presents 3 sets of bank statements from different accounts/institutions, each one under separate named tables (Stmt1, Stmt2, Stmt3). By using structured referencing it helps the effort of keeping track of the latest balance for each statement as they keep growing over time.

    At the very top, cell F1 dynamically sums the latest balance (last populated row) of each statement in order to inform the user the grand total of cash "on hand":
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    So far, so good........ until there's always a BUT.........

    In case I keep opening up new checking/savings/trading accounts and therefore new statements (Stmt4, Stmt5 and so on) start popping up to the right of the existing ones (column O onwards), HOW CAN I MAKE THE FORMULA ON F1 TO AUTOMATICALLY/DYNAMICALLY ADD THOSE NEW NAMED TABLES TO ITS SUM?

    The obvious answer on such simple schedule is to just manually copy/paste the LOOKUP formula and change to the newly added table name. However my real life workbook is way more complex than that, and such task would not only be a chore but I also risk forgetting to incorporate those new statements to the tally formula. Thus I need a formula that recognizes as new statements are added so I don't have to worry about doing that in the future, and without recurring to VBA coding or helper columns.

    1D Spilled Sum Last Non-Empty Rows.png

    So I started my attempt to get to a solution by naming each table the same + a sequential number 1, 2, 3, etc. as this allows a recognition mechanism as new tables are added. Then I created a SEQUENCE formula based on the COUNTA of statement titles on row 3:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    And this enabled me to concatenate the structured referencing for all "Balance" columns on each statement:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    And as shown on the screenshot that follows I seemed to be on the right track to get to an INDIRECT "spilled" type solution that should do the trick just fine...

    1D Spilled Sum Last Non-Empty Rows SEQUENCE, INDIRECT Text Spill.png

    But that's when things started to go south......

    I tried 4 different approaches to dynamically pick up the latest balance/last populated row of each statement table, but none of them worked in a way that would provide a dynamic solution that will ensure all future statements be integrated in the sum without further finagling.

    My first go was by using the same LOOKUP(2;1/.... approach that returns the last non-empty row of a column. But this one is a no starter as it does not return a cell reference, so SUBTOTAL won't even take it (SUM/AGGREGATE do take nested functions that return values, but won't deal with spilled ranges so they are not feasible options).
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    1D Spilled Sum Last Non-Empty Rows LOOKUP.png

    Then I attempted 3 different combinations of INDEX, and they all managed to get to a "spilled" solution but returning ZERO amount, and by decomposing each formula I realized that despite achieving spilled solutions they all return errors.

    MAX/ROW:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    COUNTA:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    INDIRECT/ADDRESS:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    It can be seen on each screenshot for every approach that they all do work individually (ORANGE sections), but this way I would get to the same static formula that won't automatically incorporate further statements.

    What am I doing wrong here? Is there any other way to go about that I can't seem to grasp? Any help on this is greatly appreciated!

    Below I added screenshots for each of the above mentioned INDEX combinations...

    1D Spilled Sum Last Non-Empty Rows INDEX.png
    Attached Files Attached Files
    Last edited by leolapa; 06-08-2021 at 11:35 AM. Reason: Attach sample file

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,201

    Re: Dynamic SUM of multiple named tables (structured referencing)

    Administrative Note:

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not provided the required cross-post link(s) here.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    (Note: this requirement is not optional. No help to be offered until the link is provided.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    11-27-2015
    Location
    Sao Paulo, Brazil
    MS-Off Ver
    MS Office 365
    Posts
    42

    Re: Dynamic SUM of multiple named tables (structured referencing)

    Thanks for the heads up and sorry for the inconvenience. Will make sure to comply next time...

    https://www.excelforum.com/excel-for...ferencing.html

    https://www.mrexcel.com/board/thread...ncing.1172744/

    https://answers.microsoft.com/en-us/...0-e8586c674960
    Last edited by AliGW; 06-08-2021 at 11:31 AM. Reason: PLEASE don't quote unnecessarily!

+ 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. @ - Structured Table Referencing causing dramas
    By JeffGrant in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-03-2021, 06:05 AM
  2. @ - Structured Table Referencing causing dramas
    By JeffGrant in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-03-2021, 04:33 AM
  3. [SOLVED] Tables and Structured References in an expanding range
    By JimDandy in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 08-02-2019, 10:48 AM
  4. [SOLVED] Cannot use structured references for tables
    By aliceinwonderland in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-09-2018, 01:29 PM
  5. Structured Referencing tables
    By Tom_J_W in forum Excel General
    Replies: 8
    Last Post: 06-17-2013, 03:03 AM
  6. Dynamic Named Range and Pivot Tables - Blank Cells
    By nathanB in forum Excel General
    Replies: 1
    Last Post: 11-29-2012, 09:11 AM
  7. Pivot tables & dynamic named ranges
    By WillysK5 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-05-2008, 04:32 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