+ Reply to Thread
Results 1 to 10 of 10

COUNTIFS that only counts unique values

  1. #1
    Registered User
    Join Date
    10-23-2012
    Location
    Portland, OR
    MS-Off Ver
    Microsoft 365
    Posts
    50

    COUNTIFS that only counts unique values

    Hi there,

    I'm currently trying to write a formula to count the total number of alpha-numeric codes, per person, per month. The problem I have is, some of the codes repeat themselves, so I can't seem to figure out how to count the unique occurrences, per person.

    I've attached a rough sample.

    Thank you SO much for any and all help.
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: COUNTIFS that only counts unique values

    Try this:

    =SUMPRODUCT(($A$2:$A$14=E2)*($B$2:$C$14=E1)*($B$1:$C$1=F1))

    These are not really unique values, however ...
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: COUNTIFS that only counts unique values

    Hi,

    This is clearly a much simplified example and probably doesn't represent the size of your actual data. We often find that when we give an answer to what is a trivial non representative example, when the solution is used with the real world data it doesn't work because of factors like string length and other stuff which is important but hasn't been mentioned. It's also not clear what you mean by unique. You say unique by person but since you've added a cell for month that implies the month shoukd enter the calculation.

    YOu ask for a formula but in many cases like this a Pivot Table will provide the answer without you needing to resort to formulae. In this case you'd need to create a data range of three columns. Date, Name, Value (i.e. A1, A2..etc)

    Therefore upload your real workbook (or at least a cut down copy), and manually add the results you expect to see.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    10-23-2012
    Location
    Portland, OR
    MS-Off Ver
    Microsoft 365
    Posts
    50

    Re: COUNTIFS that only counts unique values

    Ali,

    As always, you've got an amazing solution. One thing I realized is, I included my "unique" ID in E1, however, is it possible if I don't have the ID provided? In other words, I have truly unique IDs, such as 0060g000010eGlH, but they're in my source data. I'll end up with hundreds of them. What I was HOPING to be able to do was write a formula that saw those IDs as unique, without having to actually list them out. Does that make sense?

    Thank you SO much for your help.

  5. #5
    Registered User
    Join Date
    10-23-2012
    Location
    Portland, OR
    MS-Off Ver
    Microsoft 365
    Posts
    50

    Re: COUNTIFS that only counts unique values

    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    This is clearly a much simplified example ...
    Hey Richard!

    Thanks for the response. I definitely understand that a pivot table could work here, but the way that I've built some of the dependent tables and such has me a little more comfortable with a formula... if possible. That said, I'll work on creating a better source file.

    You are correct that I'm trying to break out the data by rep, by month. My data source is going to continue to grow, month after month.

    Thanks again for the response!!
    Last edited by AliGW; 02-02-2020 at 06:53 AM. Reason: Please don't quote unnecessarily!

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: COUNTIFS that only counts unique values

    Quote Originally Posted by tkoral View Post
    Ali,
    ... Does that make sense? ...
    No - not really!

    As Richard suggested, provide a more realistic set of data for us to work with.

  7. #7
    Registered User
    Join Date
    10-23-2012
    Location
    Portland, OR
    MS-Off Ver
    Microsoft 365
    Posts
    50

    Re: COUNTIFS that only counts unique values

    Hi there,

    I've attached a better, more realistic example of work. Please let me know if you have more questions.

    Thanks!
    Attached Files Attached Files

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: COUNTIFS that only counts unique values

    Try this:

    =SUM(--(FREQUENCY(IF($A$2:$A$33=$G2,IF($C$2:$C$33=$F$1,MATCH($B$2:$B$33,$B$2:$B$33,0))),ROW($B$2:$B$33)-ROW(B2)+1)>0))

    ... confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

    EDIT: might need to be this, actually:

    =SUM(--(FREQUENCY(IF($A$2:$A$33=$G2,IF($D$2:$D$33=H$1,IF($C$2:$C$33=$F$1,MATCH($B$2:$B$33,$B$2:$B$33,0)))),ROW($B$2:$B$33)-ROW(B2)+1)>0))

    Excel 2016 (Windows) 32 bit
    F
    G
    H
    I
    1
    Verbal/Commit Assigned
    Jan
    Feb
    2
    Bob
    3
    1
    3
    Susan
    3
    2
    4
    Tom
    1
    1
    5
    Todd
    2
    0
    Sheet: Sheet1
    Attached Files Attached Files
    Last edited by AliGW; 02-02-2020 at 07:13 AM.

  9. #9
    Registered User
    Join Date
    10-23-2012
    Location
    Portland, OR
    MS-Off Ver
    Microsoft 365
    Posts
    50

    Re: COUNTIFS that only counts unique values

    As always, this works perfectly. I canNOT thank you enough!!!!

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: COUNTIFS that only counts unique values

    No problem.

+ 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. Replies: 3
    Last Post: 12-09-2019, 12:44 PM
  2. Get unique values from column and get Counts and Sums based on these values
    By khhleung in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-17-2014, 09:58 PM
  3. Unique counts of a values/logins per day
    By tylercweinrich in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-13-2014, 03:28 PM
  4. Formula that counts number of unique text values if it meets criteria
    By ruledwritingpaper in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-15-2014, 02:57 PM
  5. Formula that counts unique values within a criteria
    By GRACEROUHANA in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 11-03-2013, 01:20 PM
  6. Counts unique values per dates
    By albert28 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-07-2013, 06:10 AM
  7. Counts of unique values with multiple criteria
    By ChristiaanV in forum Excel General
    Replies: 4
    Last Post: 03-09-2011, 12:47 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