IF you happen to have Excel 365 and your profile is out of date, then you could use this in C10 of your original sheet, copied down:

=LET(x,FILTER($D$3:$N$5,$A$3:$A$5=A10),FILTER($D$2:$N$2,x=1))