Hi there,
Sorry for the late reply.
Since your data is in column wise, you will have to nest some formulas together:
In the cell O4, the formula can be: =SUM(SUM(FILTER(F4:F6,D4:D6=N4,0)),SUM(FILTER(I4:I6,G4:G6=N4,0)),SUM(FILTER(L4:L6,J4:J6=N4,0)))
In the cell O5, the formula can be: =SUM(SUM(FILTER(F4:F6,D4:D6=N5,0)),SUM(FILTER(I4:I6,G4:G6=N5,0)),SUM(FILTER(L4:L6,J4:J6=N5,0)))
In the cell P4, the formula can be: =TEXTJOIN(",",TRUE,TEXTJOIN(",",TRUE,FILTER(E4:E6,D4:D6=N4,"")),TEXTJOIN(",",TRUE,FILTER(H4:H6,G4:G6=N4,"")),TEXTJOIN(",",TRUE,FILTER(K4:K6,J4:J6=N4,"")))
In the cell P5, the formula can be: =TEXTJOIN(",",TRUE,TEXTJOIN(",",TRUE,FILTER(E4:E6,D4:D6=N5,"")),TEXTJOIN(",",TRUE,FILTER(H4:H6,G4:G6=N5,"")),TEXTJOIN(",",TRUE,FILTER(K4:K6,J4:J6=N5,"")))
Please give it a try.
Amanda