If I understand the concept of the countifs for row 4 correctly then perhaps the following formula, intended for cell B4, will be helpful:
Formula: copy to clipboard
=SUMPRODUCT((YearRecvd=2018)*(MonthComplete>MonthRecvd)*(MonthRecvd< COLUMN()))

Note: Although it seems to me as if it should read ...COLUMN()-1)) based on the statement "& MonthReceived is before each month"
Let us know if you have any questions.