I've run into a tricky problem which I think I have an inelegant solution for, but wanted to see if there was something cleaner. It takes a bit of explaining so please bear with me:

The problem essentially boils down to this: think of 2 inputs, how much money I get in a given day, and how long that money lasts me. A simple version of the model looks like this:
  • Input 1 - how many days money lasts me: 3
  • Input 2 - amount of money received on day 1: $300

The output would essentially be a bunch of columns representing day 1 to day 20, and depending on my inputs, they show how much money I can spend each day. Let's assume for simplicity that that amount is just amount received divided by days.

This is the first area of trickiness, I it's not enough for me to put $300/3 in each cell, but the cells need to know when the 3 days has been reached, and if someone put 5 instead, they need to similarly now divide $300/5 but now show up in 5 cells, with the remaining days showing 0.

If it was simply this I think it would be a relatively easy solution, but the tricky thing is the way I have it, it's not just day 1 where I input how much money, but imagine now I have random payments coming in that the user can input (e.g. ok $300 day 1, $500 day 3, $1000 day 7). Thankfully the number of days it lasts me will be consistent. So as an example, this is what I would expect to get spit out with the following inputs:
  • # of days money lasts: 4
  • Day #1 money received: $100
  • Day #3 money received: $500
  • Day #4 money received: $1000

Should spit out the following values:
  • Day #1 money to spend: $25 ($100/4)
  • Day #2 money to spend: $25 ($100/4)
  • Day #3 money to spend: $150 ($100/4 + $500/4)
  • Day #4 money to spend: $400 ($100/4 + $500/4 + $1000/4)
  • Day #5 money to spend: $375 ($500/4 + $1000/4)
  • Day #6 money to spend: $375 ($500/4 + $1000/4)
  • Day #7 money to spend: $250 ($1000/4)

Hopefully this makes the problem clear. Right now my solution is to make a pretty big table (20x20 if it's 20 days), but I'm not sure if there's a more elegant solution. Thank you!