Formula Columns¶
A formula column is a column whose cells are calculated from the other columns in the same row — like a spreadsheet formula filled down every row. Write [Price] * [Qty] once and every row shows its own total, updating automatically as you edit the data it depends on.
Smart CSV Editor Pro
Formula columns are a Pro feature. You can open the editor and preview a formula for free; saving a formula column requires Pro.
Creating a formula column¶
- Long-press a column header (or use the Add Column button in the toolbar).
- Choose Add Formula Column (the icon). A new column is inserted after the column you long-pressed.
- Give the column a name, type your formula, and tap Save.
The new column appears filled with the calculated value for every row.
A header row is required
Formulas refer to other columns by their name (e.g. [Price]), so the file needs a header row to read those names from. If you don't have one turned on yet, saving your first formula automatically marks the first row as a header — the editor tells you when it's about to do this. See First Row Is Header.
The formula editor¶
The editor gives you everything needed to write a formula without typing every character:
- Formula box — a plain, monospaced text area. Autocorrect and smart-quote substitution are off so your formula isn't mangled.
- Columns — a row of tappable chips, one per referenceable column. Tap one to insert
[That Column]at the cursor. - Functions — tappable chips for every built-in function; tapping inserts e.g.
ROUND(at the cursor. - Operator bar — while the formula box is focused, a scrolling row of operator keys sits just above the keyboard:
( )+ - * /&= > < >= <= !=,". Tapping one inserts it at the cursor (arithmetic and comparison operators come with tidy spacing, and(/"insert a matching pair with the cursor placed between them). A dismiss button on the right hides the keyboard. - Preview — shows the result of your formula against the first few data rows, so you can confirm it's doing what you want before saving. Rows that would error are shown in red.
- Inline errors — if the formula doesn't parse or can't be evaluated, a red message explains why, and Save stays disabled until it's valid.
New to formulas?
The first time you open the editor, a short intro appears at the top explaining what a formula column is, with a Learn more link straight to this page. Tap Got it to dismiss it. After that, the help button in the top bar is always there to reopen these docs.
Suggestions from similar files¶
If you've already written a formula in another file with the same columns, the editor offers it back: a From Similar Files section lists each remembered formula with its column name and the file it came from. Tap one and the name and formula fill in, with the preview immediately showing the results against this file's rows — edit it further or just Save.
Suggestions come from the same on-device memory as saved setups (files you saved with customizations; matching by identical header columns), so there's nothing to enable. And if the other file's setup is offered when you open a similar file, applying it can create the formula columns directly — see Setups with formula columns.
Referring to columns¶
Wrap a column's header name in square brackets: [Unit Price], [Qty], [Category].
- Matching is case-insensitive and ignores surrounding spaces —
[price],[Price], and[ Price ]all find a column headedPrice. - If two columns share a name, the leftmost one wins.
- A formula can't reference another formula column — keep formulas based on plain data columns. (The chip list only offers columns you're allowed to use.)
Values¶
| Kind | How to write it | Notes |
|---|---|---|
| Number | 42, 3.14, .5 |
Plain decimals. |
| Text | "Paid" |
Double quotes. Smart/curly quotes work too. Double a quote to include a literal one: "say ""hi""". |
| True / false | true, false |
Case-insensitive. |
| Column value | [Header Name] |
The cell in that column on the same row. |
Numbers are read leniently
When a formula does math on a cell, it reads the number through the display formatting: currency symbols, a trailing %, and thousands separators (1,234 or 1'234) are ignored, and a lone comma is accepted as a decimal point (3,5 → 3.5). A blank cell is not treated as zero — using one in a calculation is an error.
Operators¶
From lowest to highest precedence:
| Operator | Meaning | Example |
|---|---|---|
= == != <> > < >= <= |
Comparison → true/false | [Qty] > 10 |
& |
Join text | [First] & " " & [Last] |
+ - |
Add / subtract | [Total] - [Tip] |
* / |
Multiply / divide | [Price] * [Qty] |
- (unary) |
Negate | -[Balance] |
( ) |
Grouping | ([A] + [B]) * 2 |
- Comparisons can't be chained — write
[A] > [B]and combine withIF, not[A] > [B] > [C]. - A comparison is numeric when both sides read as numbers; otherwise it compares text case-insensitively (so
[Status] = "paid"matchesPaid). - Dividing by zero is an error for that row (see
IFbelow for how to guard against it).
Functions¶
Names are case-insensitive. Arguments are separated by commas.
| Function | Arguments | What it does |
|---|---|---|
IF(cond, a, b) |
2 or 3 | If cond is true, returns a, else b (or blank when b is omitted). Only the branch taken is evaluated. |
ROUND(n, places) |
1 or 2 | Rounds n to places decimals (0 if omitted). |
ABS(n) |
1 | Absolute value. |
MIN(a, b, …) |
1 or more | Smallest of its numbers. |
MAX(a, b, …) |
1 or more | Largest of its numbers. |
CONCAT(a, b, …) |
1 or more | Joins its arguments into one string (like &). |
UPPER(s) |
1 | Uppercases text. |
LOWER(s) |
1 | Lowercases text. |
TRIM(s) |
1 | Removes leading/trailing spaces. |
LEN(s) |
1 | Number of characters. |
CONTAINS(s, sub) |
2 | True if s contains sub (case-insensitive). |
Guard a division with IF
Because IF only evaluates the branch it takes, this never divides by zero:
IF([Qty] > 0, [Total] / [Qty], 0)
Examples¶
[Unit Price] * [Qty] → line total
[Total] - [Total] * [Discount] → price after a discount
IF([Paid] = true, "Done", "Owing") → status text from a checkbox
UPPER([Category]) → CATEGORY in caps
[First] & " " & [Last] → full name
ROUND([Total] * 0.15, 2) → 15% tip, 2 decimals
IF(CONTAINS([Notes], "urgent"), "★", "") → flag rows mentioning "urgent"
Editing and removing a formula¶
- Long-press the formula column's header → Edit Formula… to change it.
- Remove Formula turns the column back into a plain data column, keeping the last calculated values as ordinary text.
- Deleting the column removes it entirely, like any other column.
When a cell can't be calculated¶
If a formula can't produce a value for a row — a blank cell used in math, text where a number is needed, a division by zero — that cell shows #ERROR. It's deliberately visible (rather than silently blank) so problems stand out, and you can jump to them with the find bar. Fixing the underlying data (or the formula) clears it.
Saving¶
Formulas are saved with the file in the same comment header as your column types and other settings (see File Formats & Saving). Reopen the file and the formula columns recompute automatically. Other apps that open the file just see the last calculated values as plain CSV text.