Excel: how to count number of distinct values in a range with condition?
Solution 1:
Use a pivot table. No formulas required. Just a few clicks.
Drag column A (called "one" in my sample) to the row labels, drag column B (called "two" in my sample) to the column labels, drag any column into the values area and set the value calculation to "count".
One row above the pivot table, use a simple Count() function to return the count of uniques:
You can filter the pivot table to show only the items with "true" or only the items with "false".
Solution 2:
Try this "array formula"
=SUM(IF(FREQUENCY(IF(B2:B100=TRUE,IF(A2:A100<>"",MATCH(A2:A100,A2:A100,0))),ROW(A2:A100)-ROW(A2)+1),1))
confirmed with CTRL+SHIFT+ENTER