Question: How to automatically summarize preceding month or year?

Answer:

Formula to calculate the sum of last month: =IF(OR(MONTH(A3)>MONTH(A2),YEAR(A3)>YEAR(A2)), SUMPRODUCT(1*(MONTH($A$2:$A$9)=MONTH(A2))* $B$2:$B$9*(YEAR(A2)=YEAR($A$2:$A$9))),"")

 

Formula to calculate the sum of last year:
=IF(YEAR(A7)>YEAR(A6), SUMPRODUCT(1*(YEAR($A$2:$A$9)=YEAR(A6))*$B$2:$B$9),"")

Copy formulas to cells below C2 and D2. Adjust the range $A$2:$A$9 to your list.

SUMPRODUCT(array1;array2;)
Returns the sum of the products of the corresponding ranges or arrays