Formulas and calculated columns

A Formula column calculates a value — a number, a text or a date — automatically from other columns in the same row — like a spreadsheet cell. It is read-only and recalculates itself whenever the source values change. Alongside it live three sibling column types that also derive their value instead of storing one: Lookup, Rollup, and Reverse links, which read through the connections between tables.

Referencing columns

You write the formula in the table's Structure editor, when the column type is Formula. Inside it, reference another column by writing its name in curly braces: {Column name}. Each reference enters with its value:

{Price} * {Quantity}
  • Number, decimal, currency, rating, progress, and other formula columns enter with their numeric value.
  • A checkbox counts as 1 when checked and 0 when not.
  • A date enters as a date: {End} - {Start} gives the days between two dates, {Date} + 30 gives a date, and today() is today.
  • Text, select, tags, e-mail, URL and phone enter as text: you can compare them ({Status} = "Done"), join them with & and use them in text functions — only arithmetic is not allowed (the editor says so as you type). Attachment, image and reference columns cannot be used.
  • An empty cell is blank: false in a test (if({Date}, "scheduled", "no date")), equal to "" and nothing when joining text. In arithmetic an empty number counts as 0, while an empty date leaves that calculation empty. isblank({Column}) tells whether it is empty.
A formula can reference another formula — the calculation order is resolved automatically. Circular references (A depends on B which depends on A) are detected and those columns show no value instead of a wrong number.

Pulling from another table

When the row has a Reference column pointing to another table, the formula can read a field of the linked record with a dot: {Reference.Column}. It uses the first linked record of that reference.

{Product.Unit price} * {Quantity}
An empty reference (no record linked yet) counts as 0. If the linked record or the cited column no longer exists, the formula shows empty rather than inventing a number. Edits in the other table propagate: cross-table formulas are recalculated automatically, including through chains of tables.

Operators

  • Addition, subtraction, multiplication and division: + − * /
  • Division remainder: % between two values; 10% alone is a percentage (0.1)
  • Parentheses to group: ( )
  • Negative/positive sign (unary): -{Column}
  • Power: ^
  • Join text: & — {First name} & " " & {Last name}
  • Comparisons: > < >= <= = <> — they give 1 (true) or 0 (false); text is compared ignoring upper/lower case

Functions

round(x[, places])
Rounds x (optionally to a number of decimal places).
abs(x)
Absolute value (no sign).
floor(x) / ceil(x)
Rounds down / up.
sqrt(x)
Square root.
pow(x, y)
x raised to the power of y.
min(...) / max(...)
Smallest / largest among the given values.
sum(...) / avg(...)
Sum / average of the given values.
if(condition, a, b)
a when the condition is true (not 0), otherwise b — a and b can be numbers, text in quotes or dates.
and(...) / or(...) / not(x)
1 when all / any of the values are true; not(x) inverts.
today()
Today (a date).
year(d) / month(d) / day(d)
Year, month (1–12) or day of a date.
concat(...)
Joins the values into one text (the same as &).
upper(t) / lower(t) / trim(t)
Text in upper case / lower case / without extra spaces.
len(t)
Number of characters.
left(t, n) / right(t, n)
The first / last n characters.
isblank(x)
1 when the value is empty (no date, no number, empty text); 0 otherwise.
weekday(d[, type])
Day of the week: 1 = Sunday … 7 = Saturday; with type 2, 1 = Monday … 7 = Sunday.
dateadd(d, n[, unit])
The date plus n days, or "weeks", "months", "years" (a negative n goes back). Jan 31 + 1 month = Feb 28. edate(d, n) adds n months.
datediff(start, end[, unit])
From start to end in days (default), or whole "weeks", "months" or "years" — datediff({Birth date}, today(), "years") is the age.
formatdate(d[, pattern])
The date as text: dd, mm, yyyy (or aaaa), yy, mmm/mmmm (month name), ddd/dddd (weekday name) — formatdate({Date}, "mmmm yyyy").
find(part, t[, start]) / contains(t, part)
Position of part inside t (from 1; 0 when it is not there) / 1 when t contains part. Upper/lower case does not matter.
substitute(t, old, new)
Replaces every occurrence of old by new.
mod(a, b)
Remainder of a divided by b, with the sign of b (mod(-3, 2) = 1).
These are exactly the functions the engine knows — the hint under the formula field in the Structure editor lists them. Function names are case-insensitive. Text goes in quotes ("high"). The Portuguese names (SE, HOJE, E, OU, CONCATENAR, MAIÚSCULA…) also work, and ";" separates arguments as in spreadsheets — then the comma between digits is the decimal mark: SE({Price} > 1000; {Price} * 0,1; 0). Each function checks how many values it gets (if() takes 2 or 3).

Examples

{Price} * {Qty} * (1 - {Discount})
round(({Grade1} + {Grade2} + {Grade3}) / 3, 1)
max({Target} - {Achieved}, 0)
if({Total} > 1000, {Total} * 0.05, 0)
{Due date} - today()
if({Total} > 1000, "high", "low")
{First name} & " " & upper({Last name})
{Start} + 30
if(isblank({Due date}), "no due date", {Due date} - today())
datediff({Start}, {End}, "months")
if(weekday({Date}, 2) > 5, "weekend", "weekday")

When a formula shows empty

A formula prefers showing nothing over showing a misleading number. The cell stays empty when:

  • The formula cites a column name that does not exist (or was renamed).
  • A cross-table reference is broken — the linked record or target column was deleted.
  • The columns form a circular dependency.
  • The math is invalid: division by zero or a malformed expression.
  • A calculation uses an empty date ({Date} + 30, today() - {Date}) — a test or isblank() with it still works.
The Structure editor checks the formula as you type: an unknown column, text used in arithmetic or a writing error appears right under the field, and Save stays disabled until it is fixed. Below the field you also see the result for the first record.

Decimal places and display

The column takes the type of the result. A numeric result has decimal places (the default follows the round() around the formula) and takes part in sums, charts, and the Analysis view like any other number column. A text result shows as text and a date result as a date, and they sort and filter like columns of those types.

Handy companion: numeric cells offer Open calculator, a mini calculator that evaluates the same arithmetic operators and numeric functions for a one-off calculation, without creating a column.

Three more column types derive their value from the connections between tables. They are their own column types — you add them in the Structure editor like any column, not inside a formula:

Lookup
Pulls a field of the linked record, as-is (text, date, number…). You configure Via reference… (which linking column to follow) and Field to pull…. With multiple linked records it reads the first one.
Rollup
Aggregates a field across ALL the linked records: count, sum, average, minimum, or maximum. Non-numeric values are ignored instead of counting as 0.
Reverse links
Shows, on each row, the records of another table that reference it — the other direction of a Reference column. You configure the Source table and the Linked via column.
Lookup and Rollup can follow a Reverse links column too. That gives you a reverse rollup: on a Products table, a Rollup over the reverse links from Orders can sum everything ever ordered of each product — without Products holding any reference itself.
All derived columns — formula, lookup, rollup, and reverse links — are read-only and recalculate automatically after every edit. Because their value is derived, imports never write into them.