Reference adjustment on structural changes
When rows or columns are inserted, deleted or moved, affected formulas are rewritten so they keep pointing at the same data. References to deleted cells become #REF!. The behaviour when users sort or filter is specified separately, because those change the view rather than the data.
Planned. This page shows the specification from issue #192. The live example, source for every framework and the API reference replace it when the feature ships.
Live example
A grid with =SUM(B2:B6) in B7 and cross-row formulas such as =B3-B2.
Expected behavior
Inserting a row inside the range turns the formula into =SUM(B2:B7). Deleting B3 turns =B3-B2 into =#REF!-B2, which displays #REF!. Sorting keeps data-bound references intact, as documented.
Planned API surface
method: api.insertRows / api.removeRowsmethod: api.insertColumns / api.removeColumnsevent: formulasAdjustedoption: formulas.adjustOnSortAcceptance criteria
- Inserting inside a range expands it, and inserting at its edges follows a documented rule. (pending)
- Deleting all cells of a range yields #REF!, and partial deletion shrinks the range. (pending)
- Absolute references adjust the same way as relative ones for structural changes. (pending)
- The formulasAdjusted event lists the rewritten formulas, before and after. (pending)