A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Enter the following formula in sheet 1 cell G2 (based on your recent screen shot).
=SUMPRODUCT('Invoices 26-27'!$J$48:$J$75,
--('Invoices 26-27'!$F$48:$F$75=$C2),
--(IFERROR(MONTH('Invoices 26-27'!$A$48:$A$75)=MONTH(G$1),0)),
--(IFERROR(YEAR('Invoices 26-27'!$A$48:$A$75)=YEAR(G$1),0)))
Verify the value. Copy the formula to cells H2:J2.
Once you are happy with this row, copy G2:H2 down for as many codes you have on sheet 1.
Each of the SUMPRODUCT arguments will always process rows 48 to 75 of the appropriate column.
In each row, argument 2 will always access the code in that row in column C
In each column, arguments 3 and 4 will always process the date in row 1 of that column.
Recommend you change the format of cells G1:J1 to a custom format "mmm yyyy".