+ Reply to Thread
Results 1 to 8 of 8

Count Unique function in sheet with data filter applied

  1. #1
    Registered User
    Join Date
    11-26-2008
    Location
    New England
    MS-Off Ver
    2007
    Posts
    35

    Count Unique function in sheet with data filter applied

    I have a weekly sheet generated by a customer I need some help with....

    Sheet can be 1500 lines deep; I need to count unique values in one column while using a filter on two or three other columns.
    I am familiar with the "advanced" method that copies all unique values to another column, but this is a really clunky way to do it and I know there has to be a better way.
    Plus I need to count the uniques when the filters are applied and compare the results....

    And to make things _more_ complicated, this is a shared file that two or three people may be working with at a time, so the "advanced" button on the filter is grayed out.

    I attached a snippet of this weeks file.

    Thanks!
    Ted
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Count Unique function in sheet with data filter applied

    try using =subtotal(2,your-range)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Count Unique function in sheet with data filter applied

    hi Ted, maybe:
    =SUMPRODUCT(1/COUNTIF($E$5:$E$11,$E$5:$E$11)*(SUBTOTAL(3,OFFSET($E$4,ROW($E$5:$E$11)-ROW($E$5)+1,))))

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  4. #4
    Forum Expert icestationzbra's Avatar
    Join Date
    01-07-2004
    MS-Off Ver
    2007, 2010
    Posts
    1,421

    Re: Count Unique function in sheet with data filter applied

    try ARRAY-entered:

    Please Login or Register  to view this content.
    - i.s.z -
    CSE, aka Array aka { }, formulae are confirmed with CONTROL+SHIFT+ENTER.
    Replace commas ( , ) with semicolons ( ; ) in formulae, if your locale setting demands.
    All good ideas are courtesy resources from this forum as well as others around the web.
    - e.o.m -

  5. #5
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Count Unique function in sheet with data filter applied

    Maybe one way

    =SUM(IF(FREQUENCY(IF((SUBTOTAL(3,OFFSET($E$4,ROW($E$5:$E$11)-MIN(ROW($E$5:$E$11))+1,0))),MATCH($E$5:$E$11,$E$5:$E$11,0)),ROW($E$5:$E$11)-MIN(ROW($E$5:$E$11))+1),1))

    Edit: @ ICE Too fast for me!
    Last edited by Fotis1991; 01-28-2013 at 11:34 AM. Reason: Edit
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

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

    Re: Count Unique function in sheet with data filter applied

    Try this array formula**:

    =SUM(IF(FREQUENCY(IF(SUBTOTAL(3,OFFSET(E5,ROW(E5:E11)-ROW(E5),0,1)),MATCH(E5:E11,E5:E11,0)),ROW(E5:E11)-ROW(E5)+1),1))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  7. #7
    Registered User
    Join Date
    11-26-2008
    Location
    New England
    MS-Off Ver
    2007
    Posts
    35

    Re: Count Unique function in sheet with data filter applied

    All:

    Thanks for the suggestions....this is what I found when I tried them:

    Tony Valko & FOTIS: results right on >>THANKS!<<

    benishiryo: when I sort by FA (columnL) I don't get a whole number

    fdibbons: subtotal doesn't filter out repetitive entries....

    Now if I can figure out the differences b/t how Tony and Fotis get the same answer I'll feel better; might take some serious brainpower and time.

    Greatly appreciated.
    Ted

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

    Re: Count Unique function in sheet with data filter applied

    You're welcome. Thanks for the feedback!

+ 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