Share via

Count unique values between date range that match criteria

Anonymous
2017-04-12T15:58:36+00:00

I am needing to count the number of unique values in column I that meet the following criteria.  Column matches cell A1, column T has a "Y" in it, and column M is between the dates in cells DM1 (5/1/17) & DM3 (5/6/17)

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Ashish Mathur 101.9K Reputation points Volunteer Moderator
2017-04-13T03:00:17+00:00

Hi,

Try this array formula (Ctrl+Shift+Enter)

=SUMPRODUCT(1*(FREQUENCY(IF($B$2:$B$7=$A1,IF($T$2:$T$7="Y",IF($M$2:$M$7>=$DM$1,IF($M$2:$M$7<=$DM$3,MATCH($I$2:$I$7,$I$2:$I$7,0))))),ROW($B$2:$B$7)-ROW($C$1))>0))

The entry in cell A1 will be searched in B2:B7.

Hope this helps.

Was this answer helpful?

0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Ashish Mathur 101.9K Reputation points Volunteer Moderator
    2017-04-13T22:57:03+00:00

    You are welcome.  You must confirm the formula with Ctrl+Shift+Enter (not a simple Enter)

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2017-04-13T14:03:06+00:00

    Thanks!  That formula worked for what I was looking for.  I tried to edit the formula to do the same thing with a different list and it keeps giving me a #N/A error when there are values in the list that match the criteria. 

    This is what I'm needing this new formula to do:

    count unique values in CF

    CJ equals A1

    CI equals DL38

    CQ is between DM1 & DM3 (dates)

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2017-04-13T05:41:48+00:00

    Another couple of options, enter below formulas as arrray formulas (CTRL+SHIFT+ENTER):

    =SUM(IF(FREQUENCY(IF(B2:B100=A1,IF(T2:T100="Y",IF(M2:M100>=DM1,IF(M2:M100<=DM3,IF(I2:I100<>"",MATCH(I2:I100,I2:I100&"",0)))))),ROW(I2:I100)-ROW(I2)+1),1))

     OR

    =SUM(IF(I2:I100<>"",IF((T2:T100="Y")*(M2:M100>=DM1)*(M2:M100<=DM3)*(B2:B100=A1),1/(COUNTIFS(T2:T100,"Y",B2:B100,A1,M2:M100,">="&DM1,M2:M100,"<="&DM3,I2:I100,I2:I100))),0))

    Using these formulas even if any value in column I is blank or missing, the formula will not give an error (you may try to delete a unique value in column I matching the criteria and check). The logic of B2:B100 = A1 is presumed (per your statement "Column matches cell A1").

    Regards,

    Amit Tandon

    www.globaliconnect.com

    http://twitter.com/AmitTandonExcel

    Was this answer helpful?

    0 comments No comments