Given a database of 50,000 rows, counting unique values with conditions using formulas would either adversely effect workbook performance or would not work in the first place at all.
In this workbook, I have shown the technique to count unique values with conditions on a large database
1. Using PowerPivot – Will only work in Excel 2010 and higher versions
2. Using a normal Pivot Table and SUMPRODUCT() function – Will work for all versions but is not as efficient as the PowerPivot solution.
To count unique values with conditions on small databases, you may refer to the following link