Previous-frame values
A cell that reads its own last value is how you build a counter, a running total, a smoothed signal, or anything that animates. In most spreadsheets this is a circular reference — an error you work around by turning on "iterative calculation" and hoping.
In OctoMY you say it directly: prev(B1) means the value B1 had at the last frame.
The problem it solves
Write this and you get an error, correctly:
B1 = =B1 + A1 ✗ circular reference
B1 cannot be its own input. There is no order to evaluate that in.
Write this instead:
A1 = 1
B1 = =prev(B1) + A1 ✓
prev(B1) is not a reference to B1. It is a reference to a stored value from the last frame, which is an ordinary input — so the sheet stays a plain dependency graph with no loop in it, and B1 computes in one pass like every other cell.
Frames
prev() only changes value when the sheet advances a frame. Until then it holds still:
A1 = 1
B1 = =prev(B1) + A1
B1
start 1
advance 2
advance 3
advance 4
That last part matters more than it looks: editing a cell does not advance the frame. If you fix a typo in an unrelated cell, or paste a block, or change a colour, B1 does not tick. Only advancing does.
That is deliberate. If edits advanced the frame, =prev(B1)+1 would count your keystrokes, which is a different feature and a confusing one.
What it is for
A running total or counter — the example above.
Smoothing a noisy input. Blend the new value with the last one:
A1 = (some live input)
B1 = =prev(B1) * 0.9 + A1 * 0.1
Animation. A value that advances every frame is a clock, and a clock drives motion:
A1 = =prev(A1) + 0.016 a time value, advancing ~1/60 s per frame
B1 = =sin(A1) an oscillation
C1 = =vec3(0, B1 * 10, 0) a position that moves up and down
That last cell is a three-component value ready to drive something — see cell types for what makes a cell hold three numbers.
Rules worth knowing
A cell that is read through prev() still evaluates normally. It is not frozen; it computes this frame's value like any other cell. prev() just reads what it was.
prev() on a cell that has never been evaluated reads zero. Start values come from wherever you set them — often a plain literal in another cell, added in on the first frame.
A real circular reference is still an error. prev() is how you declare that a dependency crosses a frame boundary; without it, a loop is still a loop, and every cell in the loop is marked.
See also
- Use the spreadsheet for calculations — the basics
- Cell types — vectors, inference, and the type override
- Fast formulas — what compiling the sheet buys you