Try, for example in B2:

=COUNTIFS(Sheet2!$C:$C,$F$1,Sheet2!$B:$B,$A2,Sheet2!$A:$A,B$1)

Note: You have extra blanks at the end of cells in several areas (e.g. in A2 of Sheet1 and in column C of Sheet2, etc... please take them out or you won't get expected results).