+ Reply to Thread
Results 1 to 10 of 10

SUBTOTAL/SUMIF on autofilter visible cells only

  1. #1
    Registered User
    Join Date
    04-20-2009
    Location
    ogden, ut
    MS-Off Ver
    Excel 2003
    Posts
    2

    SUBTOTAL/SUMIF on autofilter visible cells only

    Hi,

    First time posting, but I've lurked/searched here for awhile now. I am having a bit of a problem getting a subtotal to work with my autofilter. On my second sheet I currently have my sheet to autofilter by customer name, products, or counties.

    I would like my SUMIF statements found below to be automatically adjusted as I autofilter by Customer name.

    I have looked at SUBTOTAL functions and even some more advanced (for me) VBA filter modules including special cells (visible cells only) however, I cannot seem to get them to work right.

    I have this currently, which works fine for my Sheet1 purposes
    =SUMIF(H9:H27,"METHANOL",J9:J27)

    I would like my SUBTOTALS to use SUMIF so that I can qualify it with the products in column H. In short, I'd like my SUBTOTAL to act the same way my SUMIF statement works, but with visible cells only.

    Hope that makes sense. Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: SUBTOTAL/SUMIF on autofilter visible cells only

    You can use this formula

    =SUMPRODUCT(--(H9:H27="METHANOL"),SUBTOTAL(9,OFFSET(J9:J27,ROW(J9:J27)-MIN(ROW(J9:J27)),0,1)))

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: SUBTOTAL/SUMIF on autofilter visible cells only

    ok from here
    http://www.ozgrid.com/forum/showthread.php?t=10337
    ive done this example . (note the link says confirm as an array formula but it seems to work without)
    filter on column c
    subtotal will only give sum of those that =martin in col a
    an explanation is given at end i think its much the same as dll's above
    Attached Files Attached Files
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Registered User
    Join Date
    04-20-2009
    Location
    ogden, ut
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: SUBTOTAL/SUMIF on autofilter visible cells only

    Thank you. The formula worked perfectly daddylonglegs.
    Martin thank you, that link will help me understand a little more about visible cells,etc.

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: SUBTOTAL/SUMIF on autofilter visible cells only

    The only real difference, Martin, is that your version, uses SUBTOTAL(3 for a COUNTA and then multiplies by the range B2:B18. If you use SUBTOTAL(9 for a SUM then you don't need to multiply by B2:B18 so you can use just

    =SUMPRODUCT((A2:A18="martin")*SUBTOTAL(9,OFFSET(A2,ROW(A2:A18)-ROW(A2),)))

    My version, where the full range J9:J27 is always used, is a little longer but lends itself to a situation where you have named ranges, rather than references

  6. #6
    Registered User
    Join Date
    03-01-2010
    Location
    London England
    MS-Off Ver
    Excel 2003
    Posts
    9

    Show an autofilter value in another cell?

    Can someone please tell me how I tell excel to display the value selected from an autofilter list into another cell, be it on the same sheet or another sheet? Any information/advice would be greatly recieved. I have attached a dummy workbook. On sheet1, I would like cell A3, B3, C3 & D3 to display the value selected from their respective list. Thanks Mikal.
    Attached Files Attached Files

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: SUBTOTAL/SUMIF on autofilter visible cells only

    @ mikal.laane please start a new thread linking to this if you want

  8. #8
    Registered User
    Join Date
    05-24-2010
    Location
    Corning, NY
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: SUBTOTAL/SUMIF on autofilter visible cells only

    This post has been very helpful for summing on an AutoFiltered List.

    Is there a way to modify the formula so that I pick up two conditions to satisfy the SUBTOTAL on J9:J27?

    For instance, I want to do the same SUBTOTAL on J9:J27 if BOTH H9:H27="METHANOL" and if G9:G27="PLANT A".

    I've tried to moditfy the formula but have not had success.

    Any suggestions would be greatly appreciated.

    Thanks,

    Akarupert

  9. #9
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: SUBTOTAL/SUMIF on autofilter visible cells only

    please read martindwilson's prior post... ie if you have a question please ask via your own thread and not via that of another member.

    (post a link to this thread from your own if you feel particularly relevant)

  10. #10
    Registered User
    Join Date
    05-14-2012
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: SUBTOTAL/SUMIF on autofilter visible cells only

    Thank you daddylonglegs for figuring that out. I was able to modify it for my spreadsheet and it worked like a charm right out of the gate.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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