Given your screenshot example you could use this formula in G2 copied down and across to L8

=IF($F2=G$1,"",SUMPRODUCT((($A$2:$A$8=$F2)+($B$2:$B$8=$F2)+($C$2:$C$8=$F2)>0)*($A$2:$C$8=G$1)))