+ Reply to Thread
Results 1 to 8 of 8

SUM a dynamic range not including hidden cells

  1. #1
    Registered User
    Join Date
    11-11-2014
    Location
    Cheltenham, England
    MS-Off Ver
    2010
    Posts
    19

    SUM a dynamic range not including hidden cells

    File attached.


    Trial.xlsm

    I am looking to SUM a range of cells along a row (G8 onwards). This row is intended to be a dynamic range (i.e. will grow), and will also be dynamically filtered (columns hidden based on user selections - not yet implemented - so have been hiding manually to test).

    I have created a simpler version of this in row 18 (G onwards) where a SUBTOTAL is calculated and only for the visible rows (=SUBTOTAL(109,G19:G55) and this seems to work well.

    I now want something slightly more elsewhere. I want a cell (Am currently trying to work with F9) to show the SUM of all the entries in Row G8 onwards but only for visible columns. I believe I have created a Dynamic Named range for G8 onwards called 'TotalHeadCount' and have then attempted to use the same SUBTOTAL formula as above but using the range as the 'TotalHeadCount' Named range. This doesn't seem to work however so I need of some help

    Cheers

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: SUM a dynamic range not including hidden cells

    Have you checked that the dynamic named range is actually returning the expected range?

    Can you post what you are using for that range?
    If posting code please use code tags, see here.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: SUM a dynamic range not including hidden cells

    Oops, didn't spot the attachment at the start of the post.

  4. #4
    Registered User
    Join Date
    11-11-2014
    Location
    Cheltenham, England
    MS-Off Ver
    2010
    Posts
    19

    Re: SUM a dynamic range not including hidden cells

    Using the following to define the dynamic named range

    =OFFSET(IAMT!$G$8,0,0,1,COUNTA(IAMT!$8:$8))

    Not sure how to check the returned value

    The SUBTOTAL function I am using seems to be returning the correct total value (i.e. if I add additional values then the subtotal is updated correctly its just the correction for hidden columns that doesn't appear to be working

  5. #5
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: SUM a dynamic range not including hidden cells

    SUBTOTAL(109,$G$8:$FH$8), hiding a column does not affect the subtotal. But, hiding a row in a subtotal of a vertical range does affect the subtotal.
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  6. #6
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: SUM a dynamic range not including hidden cells


  7. #7
    Registered User
    Join Date
    11-11-2014
    Location
    Cheltenham, England
    MS-Off Ver
    2010
    Posts
    19

    Re: SUM a dynamic range not including hidden cells

    Ah ok so the SUBTOTAL function is no good for this scenario. What can I use instead?

  8. #8
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,577

    Re: SUM a dynamic range not including hidden cells

    A combination of UDF and worksheet events given .Have a trail.
    code for UDF
    Please Login or Register  to view this content.
    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. Dynamic Range Sizes, including blanks
    By Speshul in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-12-2014, 10:52 AM
  2. Replies: 0
    Last Post: 01-15-2014, 05:17 PM
  3. Dynamic Print Range not including blank rows with formulas
    By amartin575 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-12-2013, 11:49 AM
  4. Copy & Paste data INCLUDING hidden cells? (Excel 2003)
    By EI-ALEX in forum Excel General
    Replies: 2
    Last Post: 08-09-2010, 03:52 PM
  5. [SOLVED] Create dynamic dropdown from range including blanks
    By Mike Mick in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-16-2006, 12:00 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