+ Reply to Thread
Results 1 to 6 of 6

Thread: Add and count after filtering

  1. #1
    Registered User
    Join Date
    03-13-2010
    Location
    Cape Town, SA
    MS-Off Ver
    Excel 2007
    Posts
    48

    Thumbs up Add and count after filtering

    I have set formula to add and count rows and have got that part right.
    Once I use the filter, the totals remain the same.
    How do I change these formula to recognise the filtering I have selected.
    I want to see the new totals for the rows that are displayed.

    I have attached a simple example to show what I want to achieve.

    Is this possible?

    Thanks for your time.
    Attached Files Attached Files
    Last edited by Quagga; 01-24-2012 at 02:39 PM. Reason: Solved

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

    Re: Add and count after filtering

    Try:

    =SUMPRODUCT(SUBTOTAL(3,OFFSET($B$12:$B$100,ROW($B$12:$B$100)-MIN(ROW($B$12:$B$100)),,1)),--($I$12:$I$100>0),--($J$12:$J$100=D3))-SUMPRODUCT(SUBTOTAL(3,OFFSET($B$12:$B$100,ROW($B$12:$B$100)-MIN(ROW($B$12:$B$100)),,1)),--($I$12:$I$100<0),--($J$12:$J$100=D3))
    copied down
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Registered User
    Join Date
    03-13-2010
    Location
    Cape Town, SA
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: Add and count after filtering

    Thanks for the help with the SUMPRODUCT formula......what would the COUNTIFS formula look?

  4. #4
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: Add and count after filtering

    There isn't really a COUNTIFS equivalent because the SUBTOTAL(3,OFFSET($B$12:$B$100,ROW($B$12:$B$100)-MIN(ROW($B$12:$B$100)),,1)), which does the filtered calcs is not allowed.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  5. #5
    Registered User
    Join Date
    03-13-2010
    Location
    Cape Town, SA
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: Add and count after filtering

    I have noticed that the SUMPRODUCT formula is actually counting the number of entries and not adding the amounts up to give me a sum for that selection. How do I do this?

  6. #6
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: Add and count after filtering

    Replace $B$12:$B$100 with the summing range, and change the 3 as first arg in SUBTOTAL to 9
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

+ 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.2.0