+ Reply to Thread
Results 1 to 28 of 28

Countifs but ignoring duplicates in 1 column

  1. #1
    Registered User
    Join Date
    07-07-2015
    Location
    UK
    MS-Off Ver
    MS365 v2403
    Posts
    20

    Countifs but ignoring duplicates in 1 column

    I need to count the number of client reviews completed by each team for each month. However, a client may appear multiple times (it will be the same date each time, a client wont ever have 2 different dates) but I only want the client counted once.

    Please can you advise on how to use countifs but not counting duplicates for the client ref number or if there's another method.

    Thank you.

    Also posted here: https://www.mrexcel.com/board/thread...-once.1260439/
    Attached Files Attached Files
    Last edited by redsheep79; 06-21-2024 at 04:06 AM.

  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. 2407 (Windows 11 23H2 64-bit)
    Posts
    83,579

    Re: Countifs but ignoring duplicates in 1 column

    No expected results shown, so a guess. In G2 copied across to J2 and down:

    =IFERROR(ROWS(UNIQUE(FILTER($B$2:$C$18,($B$2:$B$18=$F2)*(MONTH($C$2:$C$18)=MONTH(G$1&0))))),0)
    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 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. 2407 (Windows 11 23H2 64-bit)
    Posts
    83,579

    Re: Countifs but ignoring duplicates in 1 column

    Or maybe this?

    =IFERROR(ROWS(UNIQUE(FILTER($A$2:$C$18,($B$2:$B$18=$F2)*(MONTH($C$2:$C$18)=MONTH(G$1&0))))),0)

  4. #4
    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. 2407 (Windows 11 23H2 64-bit)
    Posts
    83,579

    Re: Countifs but ignoring duplicates in 1 column

    Does either suggestion do what you want? If not, then what are your expected (results) for the sample dataset?

  5. #5
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,824

    Re: Countifs but ignoring duplicates in 1 column

    G2=IF(AND($F2<>"",G$1<>""),SUM(IF(FREQUENCY(IF($B$2:$B$18=$F2,IF(MONTH($C$2:$C$18)=MONTH(G$1&0),MATCH($B$2:$B$18&$C$2:$C$18,$B$2:$B$18&$C$2:$C$18,0))),ROW($C$2:$C$18)-ROW($C$2)+1),1)),"")

    copy across and down

    for office 365 and 2021 enter

    for other version Control+shift+enter

  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. 2407 (Windows 11 23H2 64-bit)
    Posts
    83,579

    Re: Countifs but ignoring duplicates in 1 column

    So, you came back to post a cross-post link (thank you), but didn't bother to acknowledge any of the suggestions made.

    If you actually ENGAGE with us, we might be able to solve your problem.

    Once again, there are NO expected results in your workbook, so until you tell us what you really want, it's all guesswork.

    Please provide feedback on the three suggestions made so far.

    Thank you.

  7. #7
    Registered User
    Join Date
    07-07-2015
    Location
    UK
    MS-Off Ver
    MS365 v2403
    Posts
    20

    Re: Countifs but ignoring duplicates in 1 column

    Sorry I've not got back to you straight away, my wife and our 3 year old are at home with D&V so I've been offline for a couple of hours clearing up sick and making sure they're OK. I'll check the suggestions as soon I can.

    Thank you for the replies so far.

  8. #8
    Registered User
    Join Date
    07-07-2015
    Location
    UK
    MS-Off Ver
    MS365 v2403
    Posts
    20

    Re: Countifs but ignoring duplicates in 1 column

    Quote Originally Posted by AliGW View Post
    Or maybe this?

    =IFERROR(ROWS(UNIQUE(FILTER($A$2:$C$18,($B$2:$B$18=$F2)*(MONTH($C$2:$C$18)=MONTH(G$1&0))))),0)
    This one seems to bring back the correct results. Thank you very much. Will this work across multiple years?

  9. #9
    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. 2407 (Windows 11 23H2 64-bit)
    Posts
    83,579

    Re: Countifs but ignoring duplicates in 1 column

    Yes, it should do.

    Glad to have helped.

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED. You can also access the SOLVED tag by editing the opening post and choosing SOLVED from the drop-down to the left of the title box.

    Also, if you have not already done so, remember that you can reward anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

  10. #10
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,824

    Re: Countifs but ignoring duplicates in 1 column

    You are sure because based on your indications ?

    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    1
    Client
    Team
    Review Completed
    April May June July
    2
    1
    ICT
    4/15/2024
    ICT
    1
    2
    0
    0
    3
    2
    ICT
    4/15/2024
    BAU
    1
    2
    0
    0
    4
    3
    BAU
    4/15/2024
    Review
    1
    0
    0
    0
    5
    4
    Review
    4/15/2024
    6
    5
    ICT
    4/15/2024
    7
    6
    Review
    4/15/2024
    8
    6
    Review
    4/15/2024
    9
    7
    Review
    4/15/2024
    10
    8
    BAU
    4/15/2024
    11
    9
    BAU
    5/15/2024
    12
    10
    ICT
    5/15/2025
    13
    10
    ICT
    5/15/2024
    14
    11
    ICT
    5/15/2024
    15
    12
    BAU
    5/15/2024
    16
    12
    BAU
    5/15/2024
    17
    13
    BAU
    5/15/2025
    18
    14
    BAU
    5/15/2024

  11. #11
    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. 2407 (Windows 11 23H2 64-bit)
    Posts
    83,579

    Re: Countifs but ignoring duplicates in 1 column

    If you are addressing me, then the OP has never actually told us what the expected results are. If they are happy with the suggestion, fine. If they hit any issues, they can come back and ask.

    AliGW on MS365 Beta Channel (Windows 11) 64 bit

    F
    G
    H
    I
    J
    1
    April May June July
    2
    ICT
    3
    3
    0
    0
    3
    BAU
    2
    4
    0
    0
    4
    Review
    3
    0
    0
    0
    Sheet: Data

    If you have a better suggestion, feel free to add it.
    Last edited by AliGW; 06-18-2024 at 11:04 AM.

  12. #12
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,824

    Re: Countifs but ignoring duplicates in 1 column

    My question was directed at the OP

  13. #13
    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. 2407 (Windows 11 23H2 64-bit)
    Posts
    83,579

    Re: Countifs but ignoring duplicates in 1 column

    That wasn't clear as your post was immediately after mine and you did not directly address the OP.

    The results you have shown in your post are not the results that my formula gives in the OP's sample file.

  14. #14
    Registered User
    Join Date
    07-07-2015
    Location
    UK
    MS-Off Ver
    MS365 v2403
    Posts
    20

    Re: Countifs but ignoring duplicates in 1 column

    I got the same results as you, which were the expected results. Not sure where CARACALLA's results came from.

    I did notice however that in error (although it actually helps for this) I had put one date as 2025. This date got counted in April's figures, which I guess is to be expected. However, I would like the results separated by year too. I changed the column header to Apr-24 but that didnt make a difference. Is there a way the column headers or formula can be tweaked please to identify by year. At the moment I only want 2024 but moving forward will want 2025. Thank you.
    Last edited by AliGW; 06-19-2024 at 06:56 AM. Reason: Please don't quote unnecessarily - use the Quick Reply button instead.

  15. #15
    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. 2407 (Windows 11 23H2 64-bit)
    Posts
    83,579

    Re: Countifs but ignoring duplicates in 1 column

    Provide an updated sample workbook and I'll sort it out for you.

  16. #16
    Registered User
    Join Date
    07-07-2015
    Location
    UK
    MS-Off Ver
    MS365 v2403
    Posts
    20

    Re: Countifs but ignoring duplicates in 1 column

    Will do, thank you.

  17. #17
    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. 2407 (Windows 11 23H2 64-bit)
    Posts
    83,579

    Re: Countifs but ignoring duplicates in 1 column

    If you generate the column and row headers ...

    G1 - =TOROW(UNIQUE(TEXT(SORT(C2:C18),"mmm-yy")))
    F2 - =SORT(UNIQUE(B2:B18))

    ... then you can use this:

    =IFERROR(ROWS(UNIQUE(FILTER($A$2:$C$18,($B$2:$B$18=$F2)*(MONTH($C$2:$C$18)=MONTH(G$1))*(YEAR($C$2:$C$18)=YEAR(G$1))))),0)
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    07-07-2015
    Location
    UK
    MS-Off Ver
    MS365 v2403
    Posts
    20

    Re: Countifs but ignoring duplicates in 1 column

    Thank you.

    I've uploaded a new test data set with results table separated by month/year. I've added in an extra column to better reflect the data I actually I have (although data from this new column is not needed)
    Attached Files Attached Files

  19. #19
    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. 2407 (Windows 11 23H2 64-bit)
    Posts
    83,579

    Re: Countifs but ignoring duplicates in 1 column

    I've set up post #17 to fit the updated workbook.

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED. You can also access the SOLVED tag by editing the opening post and choosing SOLVED from the drop-down to the left of the title box.

    Also, if you have not already done so, remember that you can reward anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.
    Attached Files Attached Files

  20. #20
    Registered User
    Join Date
    07-07-2015
    Location
    UK
    MS-Off Ver
    MS365 v2403
    Posts
    20

    Re: Countifs but ignoring duplicates in 1 column

    Thank you. I've got go out for the afternoon now so I'll take a look later on.

  21. #21
    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. 2407 (Windows 11 23H2 64-bit)
    Posts
    83,579

    Re: Countifs but ignoring duplicates in 1 column

    OK, but please don't forget to sign off the thread.

  22. #22
    Registered User
    Join Date
    07-07-2015
    Location
    UK
    MS-Off Ver
    MS365 v2403
    Posts
    20

    Re: Countifs but ignoring duplicates in 1 column

    Your post #17 does work. Thank you. However (and sorry to be a pain), I've been given an additional requirement which is to give data on a weekly basis as well as monthly. Could I add an updated sample set here or shall i do a new thread and close this one off?
    Last edited by redsheep79; 06-20-2024 at 06:24 AM.

  23. #23
    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. 2407 (Windows 11 23H2 64-bit)
    Posts
    83,579

    Re: Countifs but ignoring duplicates in 1 column

    Add it here, please.

  24. #24
    Registered User
    Join Date
    07-07-2015
    Location
    UK
    MS-Off Ver
    MS365 v2403
    Posts
    20

    Re: Countifs but ignoring duplicates in 1 column

    Thank you.

    There are 2 differences in what is required for this one:
    1. Data is required by week (I've put column header as starting date for that week but can change this to whatever makes it easier to be able to get the data)
    2. The results will be split between ICT and Non ICT (rather than each team)

    I really appreciate your time and the pain I am being. However, I am learning lots of new things which is great.
    Attached Files Attached Files

  25. #25
    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. 2407 (Windows 11 23H2 64-bit)
    Posts
    83,579

    Re: Countifs but ignoring duplicates in 1 column

    Try this:

    =IFERROR(ROWS(UNIQUE(FILTER($A$2:$C$18,($B$2:$B$18=$E2)*($C$2:$C$18>=F$1)*($C$2:$C$18<F$1+7)))),0)

    You have enough variations on a theme now to be able to experiment yourself with others, I think.

    Please Login or Register  to view this content.
    This is not what your workbook seems to show, so I've set up another table handling what I think you mean. Again, though, you have enough now to be able to work out any further tweaks yourself. Obviously shout if you get into difficulty.

    This thread really has been more than solved now, so please choose Thread Tools from the menu link above and mark this thread as SOLVED. You can also access the SOLVED tag by editing the opening post and choosing SOLVED from the drop-down to the left of the title box.

    Also, if you have not already done so, remember that you can reward anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.
    Attached Files Attached Files

  26. #26
    Forum Expert
    Join Date
    12-09-2014
    Location
    Trakai, Lithuania
    MS-Off Ver
    2016
    Posts
    1,317

    Re: Countifs but ignoring duplicates in 1 column

    Power Query
    1.
    Please Login or Register  to view this content.
    2.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  27. #27
    Registered User
    Join Date
    07-07-2015
    Location
    UK
    MS-Off Ver
    MS365 v2403
    Posts
    20

    Re: Countifs but ignoring duplicates in 1 column

    Thank you very much everyone for your input, especially AliGW.

  28. #28
    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. 2407 (Windows 11 23H2 64-bit)
    Posts
    83,579

    Re: Countifs but ignoring duplicates in 1 column

    You're welcome.

+ 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] Countifs - Ignoring irrelevant data
    By JasonMcQueen in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-05-2021, 04:34 AM
  2. [SOLVED] CountIfs(?) Ignoring Duplicates
    By thesonofdarwin in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-02-2017, 12:31 AM
  3. Count occurrence per row ignoring duplicates in column
    By braun.reivn in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-24-2015, 09:53 PM
  4. Multiple COUNTIFS ignoring duplicate values in a column
    By hamzahs in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-27-2015, 11:31 AM
  5. Countifs function, ignoring those blanks
    By stevend1978 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-19-2015, 06:33 PM
  6. [SOLVED] ignoring duplicates in countifs
    By banvir1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-14-2013, 01:21 PM
  7. [SOLVED] Countifs() ignoring FALSE?
    By y_t in forum Excel General
    Replies: 1
    Last Post: 05-25-2012, 08:53 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