+ Reply to Thread
Results 1 to 6 of 6

Count Unique Items in PivotTable?

  1. #1
    Registered User
    Join Date
    06-06-2007
    Location
    NYC, NY
    Posts
    66

    Count Unique Items in PivotTable?

    Hi hi,


    Do you know how to count unique items in PivotTable? Currently when I do a count it adds up all the items not the unique items.

    For Example

    ItemA
    ItemA
    ItemA
    ItemB

    Should result in 2 unique items but instead I get 4 items.

    I am sure there is something I can do in calculated field but I just can't think of it. Any ideas?

    Thanks,
    ~RUTH~

  2. #2
    Registered User
    Join Date
    04-24-2008
    Location
    Zurich
    Posts
    45
    You don't need a Pivot table for that. To count the items in range A1:A100 use the formula below:
    Please Login or Register  to view this content.
    this is a matrix formula. Therefore close it by Ctrl-Shift-Enter.

  3. #3
    Registered User
    Join Date
    06-06-2007
    Location
    NYC, NY
    Posts
    66

    Explain code please.

    I haven't tried this out yet b/c I am not at the office but I am not sure I understand what this code is doing. I know the count if function and if and sum. What is the 1/ about?

    Thanks,
    ~RUTH~

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Here another option without the array formula

    =IF(SUMPRODUCT(($A$2:$A2=A2)*($C$2:$C2=C2))>1,0,1)
    http://www.contextures.com/xlPivot07.html#Unique

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  5. #5
    Registered User
    Join Date
    06-06-2007
    Location
    NYC, NY
    Posts
    66

    Question Calculated field instead?

    Hi VBA Noob,

    Can I insert this formula as a calculated field instead of adding it to the database? It is complicated since the original database is in Access so I could combine two spreadsheets. I didn't know how to create a relationship in Excel. Easy in Access. So I can't add this formula in the database of Access I don't think. Or can I?

    Also how does this formula work? I have used sumproducts and ifs before but it just isn't clicking in my head.

    Thanks,
    ~RUTH~
    P.S. Seems like it has been a while. Glad you are still here! :-)

  6. #6
    Registered User
    Join Date
    06-06-2007
    Location
    NYC, NY
    Posts
    66

    Smile Clever

    VBA Noob,

    I really like your clever locking of cells. I was just looking at the formula and disregarding the $. Well done!

    I incorporated it into one of my original spreadsheets and it works great! Thanks again for being incredible.


    ~RUTH~

+ 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. Count Unique Items
    By Karleajensar in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-05-2008, 05:20 PM
  2. Count unique items in column.
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-19-2008, 10:14 AM
  3. count unique cells in range based on date
    By leedsd75 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-09-2007, 02:04 PM
  4. Count Unique Entries
    By tangomj in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-02-2007, 11:58 AM

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