+ Reply to Thread
Results 1 to 11 of 11

How to combine Subtotal, Sumifs and more

  1. #1
    Registered User
    Join Date
    01-17-2014
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    5

    Question How to combine Subtotal, Sumifs and more

    Hey Everyone,

    I have an Excel document with two sheets(tabs).

    One is called "AnalyseData" and the other is called "New Table".

    I want to get the total of values in column K in "AnalyseData" WHEN:

    Column F in AnalyseData = Cell D12 in New Table
    Column D in AnalyseData = Cell B2 in New Table
    Column D in AnalyseData = Cell B3 in New Table

    This is my current formula:

    =SUMIFS(AnalyseData!$K:$K,AnalyseData!$F:$F,'New Table'!$D$12,AnalyseData!$D:$D,'New Table'!$B$2,AnalyseData!$D:$D,'New Table'!$B$3)


    Now I want to be able to filter the raw data in AnalyseData and make it so the formula only sums up the visible cells in column K. I have tried to use Subtotal and Sumproduct but I always seem to get an error.


    Any help would be appreciated.

    Kind Regards,

    Tipler93

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: How to combine Subtotal, Sumifs and more

    One potential workaround is to use SUBTOTAL for each value of K.

    In another column, let's say Z, put =SUBTOTAL(9,K2) and drag down. Now build the SUMIFS on column Z instead, and Filter against column Z.

    This works because SUBTOTAL = 0 when it itself is not visible.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to combine Subtotal, Sumifs and more

    Try something like this.

    =SUMPRODUCT(SUBTOTAL(9,OFFSET(AnalyseData!$K2,ROW(AnalyseData!$K2:$K100)-ROW(AnalyseData!$K2),0)),--(AnalyseData!$F2:$F100='New Table'!$D$12),--(AnalyseData!$D2:$D100='New Table'!$B$2),--(AnalyseData!$D2:$D100='New Table'!$B$3))

    You should avoid using entire columns as range references in array formulas and the SUMPRODUCT function. Use smaller specific ranges.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    01-17-2014
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: How to combine Subtotal, Sumifs and more

    The only issue is I'm looking at data which ranges from the 2nd row down more than 300,000 cells!

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to combine Subtotal, Sumifs and more

    Well, it'll work but it might take a second or two to calculate.

  6. #6
    Registered User
    Join Date
    01-17-2014
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: How to combine Subtotal, Sumifs and more

    Ok... It works but without the date option.

    So, I'm using

    =SUMPRODUCT(SUBTOTAL(109,OFFSET(AnalyseData!$K2,ROW(AnalyseData!$K:$K)-ROW(AnalyseData!$K2),0)),--(AnalyseData!$F:$F='New Table'!$D$12))

    but I still want to be able to incorporate

    Column D in AnalyseData = Cell B2 in New Table
    Column D in AnalyseData = Cell B3 in New Table

    Any ideas?

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to combine Subtotal, Sumifs and more

    I just noticed this but should have caught it earlier...

    Column D in AnalyseData = Cell B2 in New Table
    Column D in AnalyseData = Cell B3 in New Table
    Column D in AnalyseData can not = both Cell B2 and B3 in New Table at the same time.

    In other words, if you have a test for each:

    --(AnalyseData!$D2:$D100='New Table'!$B$2),--(AnalyseData!$D2:$D100='New Table'!$B$3)

    The result will always be 0 since both tests will never be true at the same time.

  8. #8
    Registered User
    Join Date
    01-17-2014
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: How to combine Subtotal, Sumifs and more

    Would there be a way to include this? Possibly as an IF statement?

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to combine Subtotal, Sumifs and more

    Quote Originally Posted by Tipler93 View Post
    Would there be a way to include this? Possibly as an IF statement?
    Do you mean to test the column for an "OR" condition?

    Column D in AnalyseData = B2 OR B3 in New Table

  10. #10
    Registered User
    Join Date
    01-17-2014
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: How to combine Subtotal, Sumifs and more

    Thank you Tony.

  11. #11
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to combine Subtotal, Sumifs and more

    You're welcome.


    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

+ 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. Combine Subtotal and Sumif
    By Rompetelo in forum Excel General
    Replies: 4
    Last Post: 12-12-2012, 09:20 AM
  2. Using SUMIFS with SUBTOTAL and filters
    By fozzie_1 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-13-2012, 07:08 AM
  3. Combining SUMIFS with SUBTOTAL
    By e_lad in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-16-2011, 11:23 AM
  4. How to combine SUBTOTAL function with ABS
    By efernandes67 in forum Excel General
    Replies: 3
    Last Post: 11-30-2007, 03:45 PM
  5. Combine Subtotal Macro
    By Harlequin in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-04-2007, 12:13 PM

Tags for this Thread

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