+ Reply to Thread
Results 1 to 2 of 2

Count Distinct Values With A Criteria In A Filtered List

  1. #1
    Registered User
    Join Date
    05-27-2008
    Posts
    28

    Count Distinct Values With A Criteria In A Filtered List

    I'm wondering if it is possible to do a count for distinct values that meet a certain criteria on a list that has filters applied to it (only use visible).

    I found an array formula to calculate distinct values:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Real example:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I also found a different array formula that counts only visible cells in a list:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I'm looking for a way to combine these such that I get the functionality of the second formula with the [criteria] piece of the first formula. Anybody know if this is possible?

    Example use case:
    Use Case.png

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Sadly... in lockdown, but based in Ireland.
    MS-Off Ver
    µSoft Office 365. Learning Excel all over again!!
    Posts
    29,938

    Re: Count Distinct Values With A Criteria In A Filtered List

    Yes, it can be done. see sheet:

    =SUM(IF(FREQUENCY(IF(SUBTOTAL(3,OFFSET($A$2,ROW($A$2:$A$13)-MIN(ROW($A$2:$A$13)),)),IF(LEFT($B$2:$B$13,1)=F15,MATCH($A$2:$A$13,$A$2:$A$13,0))),ROW($A$2:$A$13)-MIN(ROW($A$2:$A$13))+1),1))

    It is an array formula. Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Glenn



+ 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. [SOLVED] Count Values in Filtered List / Return Final Row in a Filtered List
    By HarryGreenwood in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-22-2018, 06:52 AM
  2. [SOLVED] count distinct value in range with filtered data
    By 9599lorenzo in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 03-07-2018, 11:20 AM
  3. Sum column and count distinct values in another based on multiple criteria
    By mike.greene in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 01-12-2015, 11:50 AM
  4. Count distinct values that correspond to a criteria
    By Eduard in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 04-22-2013, 01:03 PM
  5. Replies: 1
    Last Post: 03-21-2012, 07:06 PM
  6. Replies: 5
    Last Post: 03-13-2012, 06:05 AM
  7. Count distinct values with criteria
    By greencardioid in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-29-2008, 06:48 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