If I have interpreted correctly find in the attached a helper table in L1:U10.
Then this array formula in M2 filled down and across. If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.
Formula:
=IF(ROWS(M$2:M2)<=MATCH(M$1,$L$2:$L$10,0),"",SUM(--(MMULT($B$2:$J$100,TRANSPOSE((M$1=$B$1:$J$1)+($L2=$B$1:$J$1)))>1)))
Another interpretation: Also find this formula in K2 filled down with the sum in K1.
Formula:
=--(SUM(B2:J2)>1)
Bookmarks