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