Try this in B2 and filled down

=SUM(OFFSET(A2,0,0,-MIN(5,ROWS($1:1)),1))