+ Reply to Thread
Results 1 to 22 of 22

Dynamic Expanding/Contrasting Groups of Rows?

Hybrid View

  1. #1
    Registered User
    Join Date
    02-24-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    18

    Dynamic Expanding/Contrasting Groups of Rows?

    I have a spreadsheet I am trying to improve which compiles a list of materials from multiple "groups", which the items for each group are in another sheet/tab. The "Total" sheet compiles all of the items in the various group sheets. I would like the groups of rows on the Total page to be dynamic, expanding or contrasting rows as needed when more or less items are added to the group sheets.

    I have tried a few different strategies from Googling, but to no avail. If anybody can make that work it would be appreciated!
    Attached Files Attached Files

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,352

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    Hi Stasis,

    If you were using the newer version of Excel, called Excel 365 this would be an easy problem. Excel 365 has a function called VStack which looks like the answer to your question. If you are still on version 2013, your problem looks like it needs VBA for a possible answer.
    Last edited by MarvinP; 04-10-2025 at 11:00 AM.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    02-24-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    18

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    Hmm, that isn't combining data from multiple fields? Not sure how I'd implement it.

    But yes I am on Excel 365.

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,352

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    Please change your profile (top right corner of this site) to show Excel 365 as your MS-Off Ver: so we can give you a beter answer. It now shows "Excel 2013"

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,787

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    How about
    Formula: copy to clipboard
    =LET(v,VSTACK(Group1:Group4!A3:J100),FILTER(v,TAKE(v,,1)<>""))

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,352

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    Hi Stasis,

    Using Excel 365 your problem comes down to a single formula on the Totals sheet in M1 of
    Formula: copy to clipboard
    =VSTACK(Group1!A2:.J50,Group2!A3:.J50,Group3!A3:.K50,Group4!A3:.J50)

    Read about VStack and TrimRange to see how easy it is to do. See attached.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    02-24-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    18

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    Awesome thank you! Would there be any way to do this with ignoring any rows on the group sheets which are a 0 or blank quantity cell?

  8. #8
    Registered User
    Join Date
    02-24-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    18

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    Hmm, when I open your example it shows correctly, but if I try to change any cells in any of the group sheets, the M1 cell changes to #NAME? and has an error box that says unsupported function.

  9. #9
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,787

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    How about
    Formula: copy to clipboard
    =LET(v,VSTACK(Group1:Group4!A3:J100),FILTER(v,INDEX(v,,7)<>0))

  10. #10
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,787

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    Have you tried the formula I suggested?

  11. #11
    Registered User
    Join Date
    02-24-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    18

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    Quote Originally Posted by Fluff13 View Post
    Have you tried the formula I suggested?
    Yes that seems to be working. The only thing I am trying to figure out now is, I need some kind of label on the Total sheet for each group. I had done that with vertical text in a merged cell on the first column, as well as thick borders around each group's items. This solution, while it appears to work well, doesn't seem like it will work out with my group labeling method and I'm coming up blank on a way to show that. Any ideas?

  12. #12
    Registered User
    Join Date
    02-24-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    18

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    Then a couple little oddities:

    Would there be a way to not display a 0 if the cell on the other sheet is empty?
    How could I list out the sheets the formula is using instead of the : range? I tried with commas and semicolons but no luck.
    Last edited by Stasis; 04-10-2025 at 02:53 PM.

  13. #13
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,787

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    Merged cells are an abomination & can cause all sorts of problems.
    Also a formula cannot merge cells & spill formulae will not work in them.
    However if you create a named range called SheetList with this formula
    Formula: copy to clipboard
    =TOCOL(TEXTAFTER(GET.WORKBOOK(1)&T(NOW()),"]",-1))
    you can then use this formula
    Formula: copy to clipboard
    =LET(s,DROP(SheetList,1),v,VSTACK(Group1:Group4!A3:J100),sht,TOCOL(IF(SEQUENCE(,ROWS(v)/ROWS(s)),s)),f,FILTER(HSTACK(sht,v),INDEX(v,,7)<>0),IF(f="","",f))


    Although the workbook needs to be saved as an xlsm.
    Attached Files Attached Files

  14. #14
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,352

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    Hi Stasis,

    I'm added a column A to each of your Groups and changed the formula a bit. In M
    Formula: copy to clipboard
    =IFERROR(VSTACK(Group1!A2:.K50,Group2!A3:.K50,Group3!A3:.L50,Group4!A3:.K50),"-")

    See if this works for you now..

  15. #15
    Registered User
    Join Date
    02-24-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    18

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    Quote Originally Posted by MarvinP View Post
    Hi Stasis,

    I'm added a column A to each of your Groups and changed the formula a bit. In M
    Formula: copy to clipboard
    =IFERROR(VSTACK(Group1!A2:.K50,Group2!A3:.K50,Group3!A3:.L50,Group4!A3:.K50),"-")

    See if this works for you now..
    With this one, if I change anything on the group sheets the table on the Total page changes to just "-".

  16. #16
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,352

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    Hi Stasis,

    Did you make those "K50"s enough rows to include your real data? Like perhaps "K3000"s?

  17. #17
    Registered User
    Join Date
    02-24-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    18

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    Yes I did, I went with K1000.

  18. #18
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,433

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    Basic formula to collate the Groupx Sheets:
    Formula: copy to clipboard
    =LET(vs,VSTACK(Group1:Group4!A1:Z1000),f,TRIMRANGE(FILTER(vs,INDEX(vs,,1)<>"")),iff,IF(f="","",f),iff)


    Then, in cell K1, copied down:
    Formula: copy to clipboard
    =LET(lr,COUNTA(A:A),IF(B1="",A1,INDEX(K:K,ROW()-1)))
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  19. #19
    Registered User
    Join Date
    02-24-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    18

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    So far, this is working pretty well, but I can't get it to not fill in a 0 if the group sheet field is blank.

    =LET(v,VSTACK(Group1:Group4!A3:K100000),FILTER(v,INDEX(v,,7)<>0))

  20. #20
    Registered User
    Join Date
    02-24-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    18

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    If I try this one:

    =IFERROR(VSTACK(_xlfn._TRO_TRAILING(Group1!A2:K50),_xlfn._TRO_TRAILING(Group2!A3:K50),_xlfn._TRO_TRAILING(Group3!A3:L50),_xlfn._TRO_TRAILING(Group4!A3:K50)),"-")
    I get an Update Values popup browse window looking for a file for each group after I hit enter.

  21. #21
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,352

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    Did you mean K instead of L??
    Formula: copy to clipboard
    =IFERROR(VSTACK(_xlfn._TRO_TRAILING(Group1!A2:K50),_xlfn._TRO_TRAILING(Group2!A3:K50),_xlfn._TRO_TRAILING(Group3!A3:L50),_xlfn._TRO_TRAILING(Group4!A3:K50)),"-")

  22. #22
    Registered User
    Join Date
    02-24-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    18

    Re: Dynamic Expanding/Contrasting Groups of Rows?

    Quote Originally Posted by MarvinP View Post
    Did you mean K instead of L??
    Formula: copy to clipboard
    =IFERROR(VSTACK(_xlfn._TRO_TRAILING(Group1!A2:K50),_xlfn._TRO_TRAILING(Group2!A3:K50),_xlfn._TRO_TRAILING(Group3!A3:L50),_xlfn._TRO_TRAILING(Group4!A3:K50)),"-")
    That was a typo, but changing it doesn't make any difference. With that formula all I get is a "-" in the field the formula is entered, everything seems correct though.

+ 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. Dynamic Array (FILTER) & expanding formulas
    By Red Barracuda in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-07-2023, 11:44 PM
  2. Question about pivot data: refresh data without expanding groups
    By marek327 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 11-10-2022, 03:11 AM
  3. [SOLVED] Dynamic Expanding Table From Another Sheet
    By BillySpivy in forum Excel General
    Replies: 7
    Last Post: 09-09-2021, 08:45 PM
  4. shortcut for expanding/collapsing groups
    By BorisS in forum Excel General
    Replies: 5
    Last Post: 01-11-2017, 11:02 AM
  5. Is there a way to allow for Expanding Groups on a protected sheet
    By Shivaraj3027 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-02-2013, 01:02 AM
  6. [SOLVED] Creating a Dynamic Range that allows for expanding and contracting
    By Mattstudent in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-08-2012, 04:22 PM
  7. Event Macro for expanding/contracting groups not working
    By orktoss in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-22-2012, 02:23 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