DocsMOSAICPages & data

Formulas

9 min read

On this page

MOSAIC has one small formula language, used everywhere you calculate:

WhereHow
Table formula columnsA value per record, computed from the other columns with prop("Column"). See Tables
Calculation blocks (pages)One expression per line, results on the right, variables and totals. See Calculation blocks
Inline formulas (pages)$=expression$ inside a sentence shows expression = result. See Pages
Number cells (tables)Typing =expression in a number or progress cell stores its result
The calculator (canvas)An expression line with a basic or scientific keypad (angles in degrees or radians), and graphs of functions of x. See Calculator

The language never stops the editor: a mistake gives an error value shown as #ERR: message, never a crash. It works the same on every computer (always . for decimals, ISO dates).

Values

TypeWritten asNotes
Number12, 2.5, .5, 1e3Shown with up to 10 decimals, trailing zeros removed (1/3 = 0.3333333333)
Text"text" or 'text'
Booleantrue, falseShown as true / false; counts as 1 / 0 in arithmetic
Datefrom today(), date(2026, 11, 16), a date cell...Shown as YYYY-MM-DD (with HH:MM when the time is not midnight)
Emptyan empty cell0 in arithmetic, "" as text, false as a condition
Errorfrom a mistakeShown as #ERR: message; an error inside a calculation makes the whole result that error

The constants pi and e are built in. Names (functions, constants, variables) ignore case: ROUND, Round and round are the same function. A leading = is accepted and ignored (=1+2 is 1+2).

Text that holds a number counts as a number where a number is expected: "4" * 2 = 8. The exception is +, which joins text when either side is text: "4" + 2 = "42".

Operators

From the lowest to the highest priority:

OperatorMeaningExample
c ? a : ba when c is true, else bprop("Done") ? "Yes" : "No"
||, orOrx > 10 or y > 10
&&, andAndx > 0 && x < 1
==, !=Equal, not equalprop("Status") == "Done"
<, <=, >, >=Comparisonsprop("Due") < today()
+, -Add, subtract; + also joins text"Level " + 3 = Level 3
*, /, %Multiply, divide, remainder7 % 2 = 1
-x, +x, !x, not xNegative, positive, not!prop("Done")
^Power (right to left: 2^3^2 = 512)-2^2 = -4
x%Percent (when nothing follows it)50% = 0.5, 200 * 15% = 30

Parentheses group as usual. The typographic multiplication, division and minus signs, and the less-or-equal, greater-or-equal, not-equal and square root symbols, are accepted too (handy when you paste a formula written elsewhere).

Comparing values

  • Numbers compare as numbers, text as text (case sensitive: "a" == "A" is false), dates as dates.
  • A date compares with a text in ISO form: prop("Due") >= "2026-12-01".
  • == and != between different types are simply false / true. <, <=, >, >= between different types are an error (#ERR: cannot compare a number with a text).

Dates in arithmetic

  • date + n and date - n move a date by n days (today() + 7).
  • date - date is the number of days between them (with a fraction when the times differ).
  • date + date is an error.

Functions

Arguments in brackets [ ] are optional. Functions that take "a, b, ..." accept any number of arguments.

Logic

FunctionReturnsExample
if(condition, then[, else])then when the condition is true, else otherwise (empty when there is no else)if(prop("Hours") > 8, "Long", "Short")
ifs(c1, v1, c2, v2, ...[, else])The value of the first true conditionifs(x < 0, "neg", x == 0, "zero", "pos")
and(a, b, ...)True when every argument is trueand(prop("Art"), prop("Code"))
or(a, b, ...)True when any argument is trueor(x > 10, y > 10)
not(x)The oppositenot(prop("Done"))
empty(x)True for an empty cell or empty textempty(prop("Owner"))

if, ifs, and and or only evaluate what they need: if(x == 0, 0, 10 / x) never divides by zero.

Numbers

FunctionReturnsExample
abs(x)Absolute valueabs(-3) = 3
round(x[, decimals])Rounded (to 0 decimals by default)round(3.14159, 2) = 3.14
floor(x) / ceil(x)Rounded down / upceil(4.1) = 5
trunc(x)Decimals droppedtrunc(-4.7) = -4
sign(x)-1, 0 or 1sign(-8) = -1
min(a, b, ...) / max(a, b, ...)Smallest / largest (earliest / latest when all are dates)max(0, prop("Left"))
sum(a, b, ...)Totalsum(prop("Art"), prop("Code"))
avg(a, b, ...) (also average, mean)Averageavg(3, 4, 8) = 5
pow(x, y)x to the power y (same as x ^ y)pow(2, 10) = 1024
sqrt(x)Square rootsqrt(16) = 4
exp(x)e to the power xexp(1) = 2.7182818285
ln(x)Natural logarithmln(e) = 1
log10(x)Base 10 logarithmlog10(1000) = 3
log(x[, base])Logarithm (base 10 by default)log(8, 2) = 3
mod(a, b)Remainder (same as a % b)mod(10, 3) = 1
cbrt(x)Cube root (negative numbers too)cbrt(-27) = -3
root(x, n)n-th rootroot(81, 4) = 3
log2(x)Base 2 logarithmlog2(1024) = 10
fact(n)Factorial n! (a whole number from 0 to 170)fact(5) = 120
hypot(a, b)Length of the vector (a, b)hypot(3, 4) = 5
percent(part, total)part / total * 100 (0 when total is 0)percent(3, 12) = 25
between(x, low, high)True when x is inside the range, both ends included (numbers or dates, bounds in any order)between(daysLeft(prop("Due")), 0, 7)
clamp(x, min, max)x kept within the rangeclamp(prop("Progress"), 0, 100)
lerp(a, b, t)Linear interpolation from a to blerp(0, 200, 0.25) = 50
pi() / e()The constants (also written pi and e)2 * pi * 3

Angles

FunctionReturnsExample
rad(degrees)Degrees to radiansrad(180) = 3.1415926536
deg(radians)Radians to degreesdeg(pi / 2) = 90
sin(x), cos(x), tan(x)Sine, cosine, tangent of an angle in radianssin(rad(30)) = 0.5
asin(x), acos(x)Inverse sine / cosine (x from -1 to 1), in radiansdeg(acos(0)) = 90
atan(x)Inverse tangent, in radiansdeg(atan(1)) = 45
atan2(y, x)Angle of the point (x, y), in radiansdeg(atan2(1, 1)) = 45
sinh(x), cosh(x), tanh(x)Hyperbolic sine, cosine, tangenttanh(0) = 0

Angles are in radians everywhere, except in the calculator's Scientific mode set to DEG: there sin, cos and tan take degrees and asin, acos, atan and atan2 return degrees (sin(30) = 0.5, atan(1) = 45). The hyperbolic functions, rad() and deg() are not affected. Graphs always use radians. See Calculator.

Text

FunctionReturnsExample
concat(a, b, ...)The values joined as textconcat("v", 1, ".", 2) = v1.2
length(text)Number of characterslength("Mosaic") = 6
lower(text) / upper(text)Lower / upper caseupper("ui") = UI
trim(text)Spaces removed at both endstrim(" a ") = a
contains(text, part)True when the text contains the part (case sensitive)contains(prop("Tags"), "Bug")
replace(text, from, to) (also replaceAll)Every occurrence replacedreplace("a-b-c", "-", "/") = a/b/c
slice(text, start[, end])Part of a text; positions from 0, negative from the endslice("Mosaic", 0, 3) = Mos
format(x[, decimals])The value as text (0 to 12 decimals)format(2/3, 2) = 0.67
toText(x)The value as texttoText(12) + "%" = 12%
toNumber(text) (also number)The text as a number (an error when it is not one)toNumber("3.5") * 2 = 7

Dates

FunctionReturnsExample
now()The current date and timenow()
today()Today's date (midnight)today()
date(year, month, day)A datedate(2026, 12, 24)
dateAdd(date, n, unit)The date moved forwarddateAdd(today(), 2, "weeks")
dateSubtract(date, n, unit)The date moved backdateSubtract(prop("Due"), 3, "days")
dateBetween(a, b, unit)Whole units from b to a (negative when a is before b)dateBetween(prop("Due"), today(), "days")
year(date), month(date), day(date)Year, month (1 to 12), day of the monthmonth(today())
hour(date), minute(date)Hour (0 to 23), minutehour(now())
weekday(date)Day of the week, 1 = Monday ... 7 = Sundayweekday(today()) >= 6 (weekend)
weeknum(date)ISO week number (weeks start on Monday; week 1 holds the year's first Thursday)weeknum(prop("Due"))
daysLeft(date)Whole days from today to the date: 0 today, negative when it has passed (empty for an empty cell)daysLeft(prop("Due")) < 0 (overdue)
hoursLeft(date)Hours from now to the date (negative when it has passed); a date without a time counts from midnighthoursLeft(prop("Due")) < 24
remaining(end[, start])The time left as text, like a Remaining column: "3d 4h left", "Starts in 2d", "Due today", "Overdue 5h"remaining(prop("Due"), prop("Start"))
formatDate(date[, pattern])The date as text; the pattern uses YYYY, YY, MM, DD, HH, mm, ss (default YYYY-MM-DD)formatDate(today(), "DD/MM/YYYY")

Units for dateAdd, dateSubtract and dateBetween: "years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds" (also the singular, and the short forms y, q, w, d, h, min, sec, ms). Adding months keeps the day when it exists and otherwise uses the last day of the month (January 31 + 1 month = February 28 or 29).

Date functions also accept text in ISO form: year("2026-11-16") = 2026, and dates with a time of day: hour("2026-11-20T14:30:00") = 14. prop() of a date column with Include time gives the date with its time.

Table columns

FunctionReturnsExample
prop("Column")The value of another column in the same record, by its name (case does not matter)prop("Hours") * prop("Rate")

prop() only works in table formula columns. Values come typed from their column: numbers and progress as numbers, check boxes as booleans, dates as dates, everything else as text (multi-select values joined with ;). A formula column can read other formula columns; a loop is reported as #ERR: circular reference.

In a plan's table, prop("Progress") reads the task's real progress from 0 to 100, whether it is set by hand or automatic (from the checklist, 100 when the task is done); see Progress.

Errors

An error is shown where the result would be, as #ERR: and a short message. The most common:

MessageCause
unknown column 'X'prop("X") names a column that does not exist (check the spelling)
unknown function 'x'A misspelled function name
unknown name 'x'A word that is neither a function, a constant nor a variable (text needs quotes: "Done")
x is a function: write x(...)A function name used without its brackets
x() takes 2 argument(s), got 1Wrong number of arguments
expected a number, got text "..."Arithmetic on text that is not a number
cannot compare a number with a text<, >... between different types
division by zero/, % or mod by 0
square root of a negative number, logarithm of a number <= 0, even root of a negative number, root() of degree 0Out of the function's range
fact() needs a whole number >= 0, number is too largefact() of a negative or fractional number, or above 170
invalid date, date out of rangedate() with an impossible day, or a date moved past the year 9999
unknown date unit "..."The unit is not one of the units above
circular referenceFormula columns that read each other in a loop
prop() only works in table formulasprop() in a calculation block, an inline formula or the calculator
invalid formulaA syntax mistake (a missing bracket, two operators in a row...)
formula is too deeply nestedMore than 64 levels of brackets or calls

Calculation blocks

A calculation block (type $= at the start of a page block, or /calc) is a scratch pad for numbers:

Text
# Character budget
artists = 3
rate = 450
weeks = 6

artists * rate * weeks
contingency = ans * 10%
total

The last line shows 8910 (8100 + 810).

  • One expression per line; its result is shown on the right of the line, in a dim column (errors in red).
  • name = expression defines a variable for the lines below it. Names start with a letter or _ and may contain digits.
  • ans is the result of the previous line.
  • A line that is just sum or total adds the numeric results since the last blank line (or the last total), variable lines included; avg or average gives their average. A blank line starts a new group, which is why the example keeps its variables above a blank line.
  • Lines starting with # or // are comments.
  • Click the block to edit its text; results update while you type. Esc or Ctrl+Enter applies.

The calculator

The calculator item uses the same language, with ans for the previous result: sqrt(2), round(10/3, 2), dateAdd(today(), 7, "days"). Its Scientific mode can work in degrees (above), and its Graph mode draws expressions of x (sin(x), x^2 - 1). See Calculator for the modes, the keys and the graph.