=SUMPRODUCT((A2:A7=G1)*(B1:E1=G2)*B2:E7)
SUMPRODUCT processes arrays efficiently without needing multiple lookup functions.
SUMPRODUCT
Works well if the dataset is structured properly.