+ Reply to Thread
Results 1 to 9 of 9

Countifs (2 critera) but only once and do not count duplicates.

  1. #1
    Forum Contributor
    Join Date
    10-15-2013
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2007
    Posts
    218

    Countifs (2 critera) but only once and do not count duplicates.

    Hello All,

    Please see attached sheet,

    Sheet 1, Column V is where i would like the formula. Sheet 2 is the reference table

    I would like to count the number of unique times that the Cost Center number comes up and ignores duplicates.

    For example:
    10064 is 1 because the Reference is only AAA00007071
    10078 is 2 because the Reference has two unique numbers AAA00006600 and AAA00007170

    I manally entered in Column W so you can see what values i'm looking for.

    Thanks for the help!Countifs-Unique.xlsx

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Countifs (2 critera) but only once and do not count duplicates.

    In V5 try this array formula

    =SUM(IF(FREQUENCY(IF('REFERENCE WC_Assigned'!$B$5:$B$116=B5,MATCH('REFERENCE WC_Assigned'!$A$5:$A$116,'REFERENCE WC_Assigned'!$A$5:$A$116,0)),ROW($A$5:$A$116)-ROW(A5)),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. Press F2 on that cell and try again.

    Copy down
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Forum Contributor
    Join Date
    10-15-2013
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2007
    Posts
    218

    Re: Countifs (2 critera) but only once and do not count duplicates.

    Quote Originally Posted by Ace_XL View Post
    In V5 try this array formula

    =SUM(IF(FREQUENCY(IF('REFERENCE WC_Assigned'!$B$5:$B$116=B5,MATCH('REFERENCE WC_Assigned'!$A$5:$A$116,'REFERENCE WC_Assigned'!$A$5:$A$116,0)),ROW($A$5:$A$116)-ROW(A5)),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. Press F2 on that cell and try again.

    Copy down
    Formula works with my sample sheet.. but when i tried to place it into my actual sheets they do not.

    My Sheet 'REFERENCE WC_Assigned' the values go down to 12200. But this may change so i tried to add more range to 12500 to account for it and changed your formula to:

    =SUM(IF(FREQUENCY(IF('REFERENCE WC_Assigned'!$B$5:$B$12500=B5,MATCH('REFERENCE WC_Assigned'!$A$5:$A$12500,'REFERENCE WC_Assigned'!$A$5:$A$12500,0)),ROW($A$5:$A$12500)-ROW(A5)),1,0))


    And now it doesn't seem to work. Any thoughts?

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

    Re: Countifs (2 critera) but only once and do not count duplicates.

    Empty cells will cause problems.

    Try adding another IF before the MATCH function:

    IF('REFERENCE WC_Assigned'!$A$5:$A$12500<>"",MATCH(...
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Forum Contributor
    Join Date
    10-15-2013
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2007
    Posts
    218

    Re: Countifs (2 critera) but only once and do not count duplicates.

    Countifs-Unique (2).xlsxI made sure it was an array.

    Not sure if i got the Match right but tried that.

    Here is the full data.. maybe it helps.

  6. #6
    Forum Contributor
    Join Date
    10-15-2013
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2007
    Posts
    218

    Re: Countifs (2 critera) but only once and do not count duplicates.

    Has anyone been able to find a solution?

    Thanks the help is much apprecaited.

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

    Re: Countifs (2 critera) but only once and do not count duplicates.

    I have a download size limit of 50kb so I can't look at your file.

    Can you post a SMALL sample file and show us what result you expect?

    About 20 rows worth of data is plenty.

  8. #8
    Forum Contributor
    Join Date
    10-15-2013
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2007
    Posts
    218

    Re: Countifs (2 critera) but only once and do not count duplicates.

    Hi Tony,

    Actually the original file posted was a small sample size. I'm not sure why it is bigger then 50kb tho. However the formula provided seemed to work but not in the larger format which was posted for reference. If it would make it easier I could e-mail you the larger (265kb) directly to you?

    Thanks

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

    Re: Countifs (2 critera) but only once and do not count duplicates.

    Sorry, but I avoid "big" files as they make troubleshooting much more difficult due to having to "wade" through too much data.

+ 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 Excluding Multiple Critera
    By mphillips in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-04-2014, 11:48 PM
  2. Replies: 5
    Last Post: 05-04-2014, 10:56 AM
  3. countifs multiple critera and colums
    By kahlran in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-14-2014, 05:27 AM
  4. [SOLVED] SUMIFS, COUNTIFS, Using a date as one of the critera
    By fgruhlke in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-07-2014, 10:12 PM
  5. Count with two critera
    By mwrfsu in forum Excel General
    Replies: 2
    Last Post: 08-01-2007, 09:14 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