+ Reply to Thread
Results 1 to 4 of 4

Add subtotal to multiple columns

  1. #1
    Registered User
    Join Date
    02-27-2012
    Location
    Essex, UK
    MS-Off Ver
    365
    Posts
    4

    Add subtotal to multiple columns

    As I've not posted before today I cannot post links but I've searched and found a solved thread that provides code (by user karedog) that is very close to meeting my needs:

    Its thread ID is 1111203 and it is called: add subtotal to multiple or dynamic columns

    My question is, where the use case for that code has summarisation applied from column E, my use case requires summarisation from column D. How do I amend the code?

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow


    You may ever not need a code just using the SubTotal Excel feature (as it can be called in VBA) …

  3. #3
    Registered User
    Join Date
    02-27-2012
    Location
    Essex, UK
    MS-Off Ver
    365
    Posts
    4

    Re: Add subtotal to multiple columns

    Thanks Marc L but I have code which is building a pivot and copying that to a new sheet in order to add in further data etc and it's this final output sheet which I want to present with subtotals. Because I don't know how many columns will be present in the pivot table, I don't know how many columns I will have in my output sheet either.
    The other post I mention manages the changing number of columns to apply the subtotal perfectly - it just starts in the wrong place for me!

    Any guidance on how I can change that solution to meet my needs would be gratefully received.

  4. #4
    Registered User
    Join Date
    02-27-2012
    Location
    Essex, UK
    MS-Off Ver
    365
    Posts
    4

    Re: Add subtotal to multiple columns

    Hopefully I've managed to add 2 file attachments - the only difference between the two is that one is not macro enabled in case I shouldn't be posting .xlsm files.

    Each workbook has 3 sheets.
    Source is my demo data. Columns A:C will always hold the data that the outlining for sub-totals
    Columns D:E represent the unknown part - they and column F are sourced from a pivot table I do not know how many columns there may be between the columns headed "Hierarchy Detail" and "Total Count".

    Output shows what the macro code is currently producing - may or may not be helpful

    Desired Outcomeproduced by manually sub-totalling in 2 passes, it shows a sub-total at each change in "Hierarchy Level 1" and further at each change in "Hierarchy 2"
    Attached Files Attached Files

+ 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. [SOLVED] Add Subtotal to multiple or dynamic columns
    By kay007 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-30-2019, 10:42 AM
  2. [SOLVED] subtotal for many columns
    By Chimborasso in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-23-2015, 01:32 PM
  3. Subtotal - Delete zero Subtotal and prior rows that calculate to that zero Subtotal
    By Whatsherface in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-14-2012, 08:37 PM
  4. subtotal only visible columns
    By nd4spd in forum Excel General
    Replies: 4
    Last Post: 08-01-2011, 11:47 AM
  5. Subtotal for many columns
    By cube00 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-28-2008, 03:47 PM
  6. [SOLVED] Subtotal multiple columns
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-21-2006, 03:30 PM
  7. Subtotal by two columns at once
    By Katherine in forum Excel General
    Replies: 1
    Last Post: 01-20-2005, 05:06 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