Context
Here column C contains a running total of the last 5 items from column B.
Formula
The formula is straightforward:
Question
In the above, it's hardcoded for a running total of 5.
What's a good way to have the running total length specified in a separate cell instead of being hardcoded to 5?
I.e. something like this:
so that the user can easily change the 5 to a 7 to get a running total of the last 7.
Link to doc
Link to the spreadsheet shown above.


