In H6.. use Array Formula as

Formula: copy to clipboard
=SUM(IF($D$6:$D$16=$G6,1/COUNTIFS($D$6:$D$16,$G6,$C$6:$C$16,$C$6:$C$16)))


To confirm the formula, press Ctrl + Shift + Enter, Not just Enter...