Formulas
On this page
MOSAIC has one small formula language, used everywhere you calculate:
| Where | How |
|---|---|
| Table formula columns | A 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
| Type | Written as | Notes |
|---|---|---|
| Number | 12, 2.5, .5, 1e3 | Shown with up to 10 decimals, trailing zeros removed (1/3 = 0.3333333333) |
| Text | "text" or 'text' | |
| Boolean | true, false | Shown as true / false; counts as 1 / 0 in arithmetic |
| Date | from today(), date(2026, 11, 16), a date cell... | Shown as YYYY-MM-DD (with HH:MM when the time is not midnight) |
| Empty | an empty cell | 0 in arithmetic, "" as text, false as a condition |
| Error | from a mistake | Shown 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:
| Operator | Meaning | Example |
|---|---|---|
c ? a : b | a when c is true, else b | prop("Done") ? "Yes" : "No" |
||, or | Or | x > 10 or y > 10 |
&&, and | And | x > 0 && x < 1 |
==, != | Equal, not equal | prop("Status") == "Done" |
<, <=, >, >= | Comparisons | prop("Due") < today() |
+, - | Add, subtract; + also joins text | "Level " + 3 = Level 3 |
*, /, % | Multiply, divide, remainder | 7 % 2 = 1 |
-x, +x, !x, not x | Negative, 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 + nanddate - nmove a date by n days (today() + 7).date - dateis the number of days between them (with a fraction when the times differ).date + dateis an error.
Functions
Arguments in brackets [ ] are optional. Functions that take "a, b, ..." accept any number of arguments.
Logic
| Function | Returns | Example |
|---|---|---|
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 condition | ifs(x < 0, "neg", x == 0, "zero", "pos") |
and(a, b, ...) | True when every argument is true | and(prop("Art"), prop("Code")) |
or(a, b, ...) | True when any argument is true | or(x > 10, y > 10) |
not(x) | The opposite | not(prop("Done")) |
empty(x) | True for an empty cell or empty text | empty(prop("Owner")) |
if, ifs, and and or only evaluate what they need: if(x == 0, 0, 10 / x) never divides by zero.
Numbers
| Function | Returns | Example |
|---|---|---|
abs(x) | Absolute value | abs(-3) = 3 |
round(x[, decimals]) | Rounded (to 0 decimals by default) | round(3.14159, 2) = 3.14 |
floor(x) / ceil(x) | Rounded down / up | ceil(4.1) = 5 |
trunc(x) | Decimals dropped | trunc(-4.7) = -4 |
sign(x) | -1, 0 or 1 | sign(-8) = -1 |
min(a, b, ...) / max(a, b, ...) | Smallest / largest (earliest / latest when all are dates) | max(0, prop("Left")) |
sum(a, b, ...) | Total | sum(prop("Art"), prop("Code")) |
avg(a, b, ...) (also average, mean) | Average | avg(3, 4, 8) = 5 |
pow(x, y) | x to the power y (same as x ^ y) | pow(2, 10) = 1024 |
sqrt(x) | Square root | sqrt(16) = 4 |
exp(x) | e to the power x | exp(1) = 2.7182818285 |
ln(x) | Natural logarithm | ln(e) = 1 |
log10(x) | Base 10 logarithm | log10(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 root | root(81, 4) = 3 |
log2(x) | Base 2 logarithm | log2(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 range | clamp(prop("Progress"), 0, 100) |
lerp(a, b, t) | Linear interpolation from a to b | lerp(0, 200, 0.25) = 50 |
pi() / e() | The constants (also written pi and e) | 2 * pi * 3 |
Angles
| Function | Returns | Example |
|---|---|---|
rad(degrees) | Degrees to radians | rad(180) = 3.1415926536 |
deg(radians) | Radians to degrees | deg(pi / 2) = 90 |
sin(x), cos(x), tan(x) | Sine, cosine, tangent of an angle in radians | sin(rad(30)) = 0.5 |
asin(x), acos(x) | Inverse sine / cosine (x from -1 to 1), in radians | deg(acos(0)) = 90 |
atan(x) | Inverse tangent, in radians | deg(atan(1)) = 45 |
atan2(y, x) | Angle of the point (x, y), in radians | deg(atan2(1, 1)) = 45 |
sinh(x), cosh(x), tanh(x) | Hyperbolic sine, cosine, tangent | tanh(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
| Function | Returns | Example |
|---|---|---|
concat(a, b, ...) | The values joined as text | concat("v", 1, ".", 2) = v1.2 |
length(text) | Number of characters | length("Mosaic") = 6 |
lower(text) / upper(text) | Lower / upper case | upper("ui") = UI |
trim(text) | Spaces removed at both ends | trim(" 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 replaced | replace("a-b-c", "-", "/") = a/b/c |
slice(text, start[, end]) | Part of a text; positions from 0, negative from the end | slice("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 text | toText(12) + "%" = 12% |
toNumber(text) (also number) | The text as a number (an error when it is not one) | toNumber("3.5") * 2 = 7 |
Dates
| Function | Returns | Example |
|---|---|---|
now() | The current date and time | now() |
today() | Today's date (midnight) | today() |
date(year, month, day) | A date | date(2026, 12, 24) |
dateAdd(date, n, unit) | The date moved forward | dateAdd(today(), 2, "weeks") |
dateSubtract(date, n, unit) | The date moved back | dateSubtract(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 month | month(today()) |
hour(date), minute(date) | Hour (0 to 23), minute | hour(now()) |
weekday(date) | Day of the week, 1 = Monday ... 7 = Sunday | weekday(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 midnight | hoursLeft(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
| Function | Returns | Example |
|---|---|---|
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:
| Message | Cause |
|---|---|
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 1 | Wrong 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 0 | Out of the function's range |
fact() needs a whole number >= 0, number is too large | fact() of a negative or fractional number, or above 170 |
invalid date, date out of range | date() 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 reference | Formula columns that read each other in a loop |
prop() only works in table formulas | prop() in a calculation block, an inline formula or the calculator |
invalid formula | A syntax mistake (a missing bracket, two operators in a row...) |
formula is too deeply nested | More 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:
# Character budget
artists = 3
rate = 450
weeks = 6
artists * rate * weeks
contingency = ans * 10%
totalThe 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 = expressiondefines a variable for the lines below it. Names start with a letter or_and may contain digits.ansis the result of the previous line.- A line that is just
sumortotaladds the numeric results since the last blank line (or the last total), variable lines included;avgoraveragegives 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.