Formulas
Every text-shaped cell in a Dock table can hold a spreadsheet formula. 39 functions, Sheets-compatible A1 references, dependents update live when sources change. (Looking for the table itself, or for column types and bulk ops? See table mode.)
Entering a formula
Select any cell, press =, and the formula bar above the table takes focus with the equals sign already seeded. The bar shows the formula source; the cell shows the computed value once you commit with Enter (or Tab to commit + move right).
Cells can also be edited directly: double-click a cell, type =SUM(B1:B10), and press Enter. The press-= keystroke handoff is identical — the bar always hosts the live editing surface, so autocomplete, error preview, and the function picker work the same regardless of where you started typing.
While editing, the bar's right-side readout previews the computed value (or a plain-language error sentence if the formula is broken). Press Escape to cancel without saving.
The fx picker
Don't remember the function name? Click the fx chip in the formula bar to open the function library. Functions are grouped by category (Math, Logic, Text, Date, Lookup, Predicates) and searchable by name or description. Click any entry to insert FUNCNAME(at the bar's cursor and start filling in arguments.
Cell references & ranges
Dock uses Sheets-style A1 notation. Columns are letters A, B, … Z, AA; rows are 1-indexed numbers. The first defined column is A, the second B, etc.
- Single cell:
=A1reads the value of column A, row 1. - Range:
=SUM(B2:B10)sums column B from row 2 to row 10, inclusive. - Whole column:
=SUM(B:B)sums every value in column B regardless of row count. Handy when the row count grows over time. - Cross-column ranges:
=SUM(A1:C5)sums every cell in the rectangle from A1 to C5.
Function catalog
Dock ships 39 functions covering the formulas most spreadsheets actually run on. Names match Sheets / Excel where they overlap, so formulas usually paste over directly.
Math
Aggregate + arithmetic across cells and ranges.
SUM(range)AVERAGE(range)COUNT(range)COUNTA(range)MIN(range)MAX(range)ROUND(value, digits)ABS(value)MOD(dividend, divisor)POWER(base, exponent)SQRT(value)ROUNDUP(value, digits)Logic
Branching, predicates, and error handling.
IF(test, then, else)AND(a, b, …)OR(a, b, …)NOT(value)IFERROR(formula, fallback)TRUE()FALSE()Text
Build, slice, and reshape strings.
CONCAT(a, b, …)TEXT(value, format)LEN(text)LEFT(text, n)RIGHT(text, n)MID(text, start, n)TRIM(text)UPPER(text)LOWER(text)Date
Date arithmetic. Dates serialise as days since 1899-12-30 internally.
TODAY()NOW()YEAR(date)MONTH(date)DAY(date)Lookup
Find values in a range by position or match.
INDEX(range, row, col?)MATCH(needle, range, mode?)Conditional aggregation
SUM + COUNT variants gated by a predicate.
SUMIF(range, criterion, sum_range?)COUNTIF(range, criterion)Predicates
Type checks. Pair with IF or IFERROR for defensive formulas.
ISBLANK(value)ISNUMBER(value)ISTEXT(value)ISLOGICAL(value)ISERROR(value)ISNA(value)Worked examples
Suppose you have a 3-row table with columns price (B), qty (C), subtotal (D), tax (E), total (F) — same shape as the demo workspace at /dock/sheets-formula-demo-2.
D1 = =B1*C1 // line-item subtotal
E1 = =D1*0.0875 // 8.75% sales tax
F1 = =D1+E1 // grand line totalD4 = =SUM(D1:D3) // sum of all subtotals
E4 = =SUM(E1:E3) // sum of all tax
F4 = =SUM(F1:F3) // grand total of all rows=IF(B2="", "—", B2*C2) // show a dash when price is missing
=IFERROR(D2/qty_zero, 0) // suppress divide-by-zero
=ROUND(AVERAGE(B1:B10), 2) // average price to 2dp
=CONCAT("Q1 revenue: $", SUM(F1:F3)) // mixed text + roll-upLive recompute
Change a source cell and every dependent updates in the same commit. Editing the qty for Bananas from 20 to 40 in the example above recomputes Bananas' subtotal, tax, and total — and the bottom Totalrow's subtotal / tax / total all roll up — without a page reload.
Dock's engine evaluates synchronously on every commit. The formula bar's right-side readout shows the fresh value the moment you press Enter; the cell itself, and every dependent cell, persists the new value in the same atomic write. Other tabs receive the update via the real-time stream within ~50ms.
Errors
When a formula can't evaluate, the cell shows the canonical Sheets / Excel code in soft red mono — never raw [Object object]or empty whitespace. Select the cell to read the plain-language explanation in the formula bar's right-side readout; hover without selecting and the same sentence appears as a tooltip.
#DIV/0!#REF!#NAME?#VALUE!#NUM!#N/A#CYCLE!Persistence model
Formula cells store as a JSON carrier on the row's data object:
{
"formula": "=SUM(B1:B10)",
"value": "318.42"
}The formula field is the source text shown in the bar; the valueis the most-recently computed display value, which the cell renders directly (so the page can paint without re-evaluating the engine on every paint). When an upstream source changes, every dependent's carrier is re-persisted in the same atomic write — so a reload always shows the freshest computed value.
Literal (non-formula) cells store as bare strings. The decoder treats anything that doesn't start with {" as a literal, so a cell whose content happens to start with =in the carrier's raw text — but isn't actually a formula carrier — round-trips as text.
Programmatic agents writing rows via the REST API can pre-build carriers (the engine will re-evaluate on hydrate either way), or write plain literal strings and let humans add the formulas in the bar.
Mobile
On touch devices the formula bar opens as a bottom sheet instead of the desktop top-bar. Tap a cell, tap the fx button in the sheet to browse functions, type the formula, and tap Commit. Autocomplete is hidden on coarse pointers in favor of the full-screen function picker, which has bigger tap targets.
Function aliases
A few user-facing names map to HyperFormula's canonical identifiers internally; you can type either form and the bar displays whatever you typed. The carrier persists the canonical form so spreadsheets imported elsewhere stay portable.
CONCAT→CONCATENATE
Keyboard
Limitations
- Cross-surface refsaren't supported yet — you can't write
=Sheet2!A1to read from a sibling table tab. Each surface evaluates in isolation. - Array formulas(CSE-style) aren't available. Use a single-cell formula per row + drag-fill to spread.
- Custom functionsaren't available. The 39-function catalog is the surface.
- Volatile functions (TODAY, NOW) re-evaluate only on commit, not on a timer. Touching any cell triggers a recompute.
Frequently asked questions
- How do I add a formula to a cell in Dock?
- Select the cell, press `=`, and the formula bar takes focus with the equals sign seeded. Type the formula (e.g. `=SUM(B1:B10)`) and press Enter or Tab to commit. The cell renders the computed value; the bar shows the formula source.
- What functions does Dock support?
- Dock ships 39 functions across Math (SUM, AVERAGE, COUNT, MIN, MAX, ROUND, ABS, MOD, POWER, SQRT, ROUNDUP), Logic (IF, AND, OR, NOT, IFERROR, TRUE, FALSE), Text (CONCAT, TEXT, LEN, LEFT, RIGHT, MID, TRIM, UPPER, LOWER), Date (TODAY, NOW, YEAR, MONTH, DAY), Lookup (INDEX, MATCH), Conditional aggregation (SUMIF, COUNTIF), and Predicates (ISBLANK, ISNUMBER, ISTEXT, ISLOGICAL, ISERROR, ISNA).
- Does Dock recalculate dependent cells when I change a source?
- Yes. When you commit a change to a source cell, every dependent formula cell evaluates and persists in the same atomic write. The cell view updates in the same tick — no reload required. Other tabs receive the update via the real-time stream within ~50ms.
- Can I use Google Sheets formulas in Dock?
- Most one-cell formulas paste over directly because Dock uses Sheets-compatible A1 references and matches Sheets / Excel function names where they overlap. CONCAT is rewritten to CONCATENATE internally. Cross-sheet references (Sheet2!A1) and array formulas aren't supported yet.
- How do I write a formula across multiple columns?
- Use a range like `=SUM(A1:C5)` to sum every cell in the rectangle, or combine refs like `=A1+B1+C1`. For whole-column sums, use `=SUM(B:B)` — handy when the row count grows over time.
- What does #DIV/0! mean in a Dock formula cell?
- The formula is dividing by zero or by an empty cell. Fill the divisor cell, or wrap the formula in IFERROR(...) to suppress the error. Select the cell to read the plain-language explanation in the formula bar.
- How are formulas stored in Dock?
- Formula cells store as a JSON carrier on the row's data: `{"formula": "=SUM(B1:B10)", "value": "318.42"}`. The formula field is the source; the value field is the most-recently computed display value, which the cell renders directly so the page doesn't need to re-evaluate the engine on every paint.
- Can my AI agent write formulas via the REST API?
- Yes. POST a row with the cell's value set to the JSON carrier (`{"formula": "=SUM(B1:B10)", "value": ""}`). The engine evaluates on hydrate and the displayed value updates on the next user commit or page interaction. Simpler: write literal strings and let the user add formulas in the bar.
- Do formulas work on mobile in Dock?
- Yes. On touch devices the formula bar opens as a bottom sheet. Tap a cell, tap the `fx` button to browse functions, type the formula, and tap Commit. Autocomplete is replaced by a full-screen function picker for bigger tap targets.
- What happens when I delete a column that's referenced by a formula?
- Every formula that references the deleted column shows `#REF!` in the cell. Hover or select the cell to see the plain-language explanation. Restore the column or update the formula to a live address to recover.
Related
- Table mode — column types, cell selection, copy / paste, find & replace.
- Rows API — REST surface for writing formula carriers from agents.
- Keyboard shortcuts — full reference, including formula-mode keystrokes.