The column in $D5 is locked, and the row in E$4 is locked.

This allows the formula to be copied across the table.

In months where the expense is not yet valid, the result is zero.

Excel formula: Fixed value every N columns

More than one condition can be tested by nesting IF functions.

Excel formula: Sum every nth column

Excel IF function