Try in E21:

=SUMPRODUCT((TEXT($D$5:$D$11,"mmm")=E$20)*($E$4:$H$10=$D21),($E$5:$H$11))



Then copied across the matrix.

Notice the offset in ranges in the 3 conditions...