+ Reply to Thread
Results 1 to 15 of 15

COUNTIFS with no duplicates

  1. #1
    Registered User
    Join Date
    08-14-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    16

    Question COUNTIFS with no duplicates

    How to modify this following formula so duplicates are counted once?

    =COUNTIFS(Assignment,">"&0,plant,"="&C54,posting_date,">="&'Months & Dates'!$C$7,posting_date,"<="&'Months & Dates'!$D$7)

    Thanks for your help.

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: COUNTIFS with no duplicates

    It's difficult to place in context without a work example.

    What are you trying to do with Count, if not count the duplicates? Are you trying to exclude duplicate rows that have all the same data?

  3. #3
    Registered User
    Join Date
    08-14-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: COUNTIFS with no duplicates

    I am trying to exclude the duplicate data.

    Thanks


    Quote Originally Posted by daffodil11 View Post
    It's difficult to place in context without a work example.

    What are you trying to do with Count, if not count the duplicates? Are you trying to exclude duplicate rows that have all the same data?

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: COUNTIFS with no duplicates

    Hi,

    Duplicates across which of your criteria? All of them? Assignment only? plant only? Assignment and plant only?

    Please try to offer as much information as you can (better still, post a workbook so that forum readers do not have to go to the trouble of artificially constructing data in which to test their potential solutions).

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

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

    Re: COUNTIFS with no duplicates

    Here's my best guess...

    You want to count the unique plants that meet the conditions.

    Try this array formula**:

    =SUM(IF(FREQUENCY(IF(Assignment>0,IF(Plant=C54,IF(Posting_Date>='Months & Dates'!$C$7,IF(Posting_Date<='Months & Dates'!$D$7,MATCH(Plant,Plant,0))))),ROW(Plant)-MIN(ROW(Plant))+1),1))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  6. #6
    Registered User
    Join Date
    08-14-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    16

    Question Re: COUNTIFS with no duplicates

    I am providing a sample data, so you can better help me out.

    On the tab "Cal", the number of assignments (which are shown on the tab "Data") needs to be counted (calculated).
    Multiple occurrences should be considered once. The posting date should be taken into consideration. "61 to 90 days" refers to the month of May (more info on the 1st tab).

    Please let me know if you have any questions.

    Thanks


    sample_data.xlsx

  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 with no duplicates

    If D5 = >90 days then what is the date range? On the Months and Dates sheet there is no beginning date for >90 days.

    Also, it would be a good idea to show us what results you expect.

  8. #8
    Registered User
    Join Date
    08-14-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: COUNTIFS with no duplicates

    Tony,

    Please consider the month of May for the calculation. The number of assignment is 1 for each plant (DFSA, DSEC and STDS) based on my manual calculation.

  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 with no duplicates

    Try this...

    On the Months and Dates sheet...

    Fill in a beginning date for >90 days. I used 4/1/2013.

    In cell A7 there is an extra space character after the 61 in the string: 61 to 90 days. Remove that extra space character.

    On the Cal sheet enter this array formula** in D7:

    =SUM(IF(FREQUENCY(IF(Data!C$5:C$16>=VLOOKUP(D$5,'Months & Dates'!A$5:D$8,3,0),IF(Data!C$5:C$16<=VLOOKUP(D$5,'Months & Dates'!A$5:D$8,4,0),IF(Data!D$5:D$16=C7,MATCH(Data!E$5:E$16,Data!E$5:E$16,0)))),ROW(Data!E$5:E$16)-ROW(Data!E$5)+1),1))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Copy down to D9

  10. #10
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,368

    Re: COUNTIFS with no duplicates

    See the files bro, give me a feedback if its meet your expectation...

    Azumi
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    08-14-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: COUNTIFS with no duplicates

    Azumi,

    You are close to the correct formula. I think FREQUENCY needs to be used to avoid counting the duplicates. Remember that the assignments should be counted once.

    Thanks

  12. #12
    Registered User
    Join Date
    08-14-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: COUNTIFS with no duplicates

    Tony,

    Your proposed formula didn’t work.

    Thank you for the attempt.



    Quote Originally Posted by Tony Valko View Post
    Here's my best guess...

    You want to count the unique plants that meet the conditions.

    Try this array formula**:

    =SUM(IF(FREQUENCY(IF(Assignment>0,IF(Plant=C54,IF(Posting_Date>='Months & Dates'!$C$7,IF(Posting_Date<='Months & Dates'!$D$7,MATCH(Plant,Plant,0))))),ROW(Plant)-MIN(ROW(Plant))+1),1))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

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

    Re: COUNTIFS with no duplicates

    Works for me.

    Here's your file with the formula implemented:

    sample_data(1).xlsx

  14. #14
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,368

    Re: COUNTIFS with no duplicates

    Ok maybe this, with little modification,

    =IF(SUMPRODUCT(--(Data!$C$5:$C$16<=$F$5),--(Data!$C$5:$C$16>=Cal!$E$5);--(Data!$D$5:$D$16=Cal!C7))>=1,1)

  15. #15
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,368

    Re: COUNTIFS with no duplicates

    Same file, other alternative formula (Array Formula):

    =SUM(--(FREQUENCY(IF((Data!$D$5:$D$16=Cal!C7)*(Data!$C$5:$C$16>=Cal!$E$5)*(Data!$C$5:$C$16<=Cal!$F$5),MATCH(Data!$E$5:$E$16,Data!$E$5:$E$16)),ROW(Data!$E$5:$E$16)-ROW(Data!$E$5)+1)>0))

    then Hit CTRL-SHIFT-ENTER Button Same time....
    Azumi

+ 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 and excluding duplicates
    By lawend in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-08-2013, 03:39 PM
  2. [SOLVED] ignoring duplicates in countifs
    By banvir1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-14-2013, 01:21 PM
  3. countifs removing duplicates referencing another sheet
    By jorncar in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-22-2013, 02:45 PM
  4. COUNTIFS and Duplicates
    By connorwfarrell in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-05-2012, 04:17 AM
  5. Countifs results excluding duplicates
    By jeffreybrown in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-28-2011, 12:22 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