Try this formula in A4 copied across
=SUMPRODUCT((data!$B3:$B300=A3)*ISNUMBER(MATCH(data!$C3:$C300,key!$A24:$A53,0)))
regards, barry