+ Reply to Thread
Results 1 to 3 of 3

Conditional Subtotal

  1. #1
    Registered User
    Join Date
    08-22-2012
    Location
    Portugal
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    1

    Conditional Subtotal

    Hello,

    I need to sum some lines of a database, using filters, and conditions such as ">0", "<0", etc.

    To use a filter and sum just the visible lines, i use subtotal(9;L:L).

    Now the problem is to select the positive values, or the negative ones, only in shown lines.

    After all, it's like making a combination os subtotal() and sum.if()

    Any suggestions?

    Bye

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Conditional Subtotal

    Something like:

    =SUMPRODUCT(SUBTOTAL(9,OFFSET($L$1:$L$1000,ROW($L$1:$L$1000)-MIN(ROW($L$1:$L$1000)),,1)),--($L$1:$L$1000>0)) for positive numbers...

    note: try not to use very large ranges (or full column references) with these formulas...
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Conditional Subtotal

    Assuming values to sum in column B, with a helper in column C, edit to match your real data.

    In the helper column use
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    autofilled to the end of your data.

    Then get your total for values >0 with
    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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