Hi folks

Trying to design a formula that outputs me the number of unique values (text & numbers, but ignoring blanks) from col B. However it should only count unique values that have the value "y" in column A. Any value in column B which has "n" in column A should be ignored in the count. Example file is attached.

I managed to get the formula for counting without the criteria based on column A:
=SUM(IF(FREQUENCY(IF(LEN(B1:B13)>0,MATCH(B1:B13,B1:B13,0),""), IF(LEN(B1:B13)>0,MATCH(B1:B13,B1:B13,0),""))>0,1))

But I can not figure out how to include the criteria to only count values in column B if they are "y" in column A.
Btw I`m using Excel 2010.

Cheers
Alohaey

example file.xlsx