Rolling formulas are very common in accounting, for example, carrying forward a monthly balance based on expenses.
So say you had a table with month, beginning balance, fixed income, expenses, and net:
| month | balance | income | expenses | net |
|-------+---------+---------+----------+---------|
| 6 | 1000.00 | 1500.00 | 500.00 | 1000.00 |
| 7 | 2000.00 | 1500.00 | 500.00 | 1000.00 |
| 8 | 3000.00 | 1500.00 | 500.00 | 1000.00 |
| 9 | 4000.00 | 1500.00 | 500.00 | 1000.00 |
I know how to calculate the net column since that's just #+TBLFM: $5=$3-$4
, but how about the balance column? The starting balance would be something you would have to manually enter based on when you started accounting, and expenses might change from month to month, but the goal would be to make it possible for the balance column to be calculated based on the previous row. Writing @2$2=@1$2 + @1$4::@3$2=@2$2 + @2$4
and so on for each row is tiring.
Is there a way to do this in org-mode?