+ Reply to Thread
Results 1 to 12 of 12

Needa a formulat to count unique values in a filtered column

  1. #1
    Registered User
    Join Date
    11-27-2012
    Location
    Washington, DC
    MS-Off Ver
    Excel 2007
    Posts
    13

    Needa a formulat to count unique values in a filtered column

    Sorry not at work so can't upload the file however I need a formula to count the unique values in a filtered column. The column has account names and a few are listed more than once. The filtered data is in column A (A2:A747).

    Thanks!

  2. #2
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Needa a formulat to count unique values in a filtered column

    You can try this:

    =SUMPRODUCT(1/COUNTIF($A$2:$A$747,$A$2:$A$747))

    - Moo

  3. #3
    Registered User
    Join Date
    11-27-2012
    Location
    Washington, DC
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Needa a formulat to count unique values in a filtered column

    This gives me 225 because I believe it counts the data from the entire data set. (A2:A747 is filtered so I need a formula that includes subtotal I believe.
    Thanks

  4. #4
    Forum Contributor
    Join Date
    11-05-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    229

    Re: Needa a formulat to count unique values in a filtered column

    Hi rabustam04,

    See if this works for you.

    Column B is the helper column, and C1 contains the result you want.

    Don't forget to click the little star to the left of this post if you feel I helped!
    Attached Files Attached Files
    Taming the Excel dragon... www.TheExcelphile.com

  5. #5
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Needa a formulat to count unique values in a filtered column

    Sorry. Looks like I'll be learning something new today, too! (if someone else replies with the correct solution).

    - Moo

  6. #6
    Registered User
    Join Date
    11-27-2012
    Location
    Washington, DC
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Needa a formulat to count unique values in a filtered column

    Using your method I get 39 unique values (my data). If I copy and paste special (values) and use the following formula I get 49 unique.

    =SUMPRODUCT(1/COUNTIF(A2:A113,A2:A113))

    can I use this formula in the filtered data? If I use this formula I get 225 because it counts all the columns
    Last edited by rabustam04; 11-27-2012 at 12:25 PM.

  7. #7
    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: Needa a formulat to count unique values in a filtered column

    Asumming that your data start in A2(A1=title and use auto filter in this), try this Array(confirm using Control+shift+enter-not just enter)

    =SUM(IF(FREQUENCY(IF(SUBTOTAL(3,OFFSET(A2,ROW(A2:A100)-ROW(A2),0)),MATCH(A2:A100,A2:A100,0)),MATCH(A2:A100,A2:A100,0)),1))
    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.

  8. #8
    Registered User
    Join Date
    11-27-2012
    Location
    Washington, DC
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Needa a formulat to count unique values in a filtered column

    Formula works!
    Last edited by rabustam04; 11-27-2012 at 12:27 PM.

  9. #9
    Registered User
    Join Date
    11-27-2012
    Location
    Washington, DC
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Needa a formulat to count unique values in a filtered column

    Quote Originally Posted by Fotis1991 View Post
    Asumming that your data start in A2(A1=title and use auto filter in this), try this Array(confirm using Control+shift+enter-not just enter)

    =SUM(IF(FREQUENCY(IF(SUBTOTAL(3,OFFSET(A2,ROW(A2:A100)-ROW(A2),0)),MATCH(A2:A100,A2:A100,0)),MATCH(A2:A100,A2:A100,0)),1))
    This formula works. Thanks!

  10. #10
    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: Needa a formulat to count unique values in a filtered column

    Welcome!

    Thanks for the reb*

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

    Re: Needa a formulat to count unique values in a filtered column

    use this variation of Fotis's formula, the performance is better:

    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 -

  12. #12
    Registered User
    Join Date
    11-27-2012
    Location
    Washington, DC
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Needa a formulat to count unique values in a filtered column

    Quote Originally Posted by icestationzbra View Post
    use this variation of Fotis's formula, the performance is better:

    Please Login or Register  to view this content.
    Tried it and works. Whats the difference?

+ 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