thesandbox.page

Circular reference

How this workbook calculates

Spreadsheets refuse a formula that depends on itself. This one allows it. A reference that stays inside its own loop reads the value from the last tick, and every other reference reads this tick's value, so the cells on a loop update together like registers in a circuit, and where they sit on the sheet makes no difference.

PREV(A1) reads last tick's value of any cell. TICK() and TIME() count calculations and seconds. KEY("left") is 1 while a key is held. Everything is a number: a test gives 1 or 0, and text can sit in a cell but a formula can't produce it.

When you press Enter, the whole sheet is sorted by what depends on what and compiled to a new WebAssembly module, and cells that share a formula share one compiled function. Compiled shows the code behind the selected cell.

Keys

Functions

ABS ACOS AND ASIN ATAN ATAN2 AVERAGE CEILING CHOOSE COLUMN COS COUNT COUNTIF DEGREES EXP IF INDEX INT KEY LET LN LOG10 MAX MIN MOD NOT OR PI POWER PREV RADIANS RAND ROUND ROW SIGN SIN SQRT SUM TAN TICK TIME TRUNC