You could perhaps use SUMIFS
to get the sum of the past 2 months sale:
=SUMIFS($C$2:C5, $A$2:A5, A5, $B$2:B5, ">="&B5-1)
This in D5 will give the sum of values that:
- Have values in cells A above and including the current row, and
- Have the month above or equal to the current month - 1.
You then only need to divide by 2 to get the 2 month average.