Using your posted workbook...
B18: =COUNTIFS($A$4:$A$14,A18,$B$4:$B$14,"C")
Copy B18 down through B21.

Is that something you can work with?