1---2title: "Formulas"3sidebar_position: 14---56# Formulas78## What you type910Typing replaces the active cell, as in Google Sheets. 012 decides what the11entry is the way Sheets does:1213| You type | You get |14|---|---|15| `Rent`, `Q3 total` | text |16| `42`, `-3.5`, `1,234`, `1e3` | a number |17| `$1,200`, `12%` | a number with currency or percent format |18| `9/26/2026`, `2026-09-26`, `Sep 26, 2026`, `14:30`, `2pm` | a date or time (a serial number with a date or time format) |19| `TRUE`, `false` | a boolean |20| `=A1*2`, `+A1*2` | a formula |21| `'42` | text, even though it looks like a number |2223That's in English (United States); in another [locale](../sheets/locale.md)24numbers, currency and dates are typed its way (`1.234,5`, `12,50 €`,25`26.09.2026` in German), and formulas with a decimal comma separate26their arguments with `;`: `=ROUND(A1*1,19; 2)`.2728A formula that doesn't parse isn't accepted: 012 stays in EDIT mode with the29caret on the problem and says what's wrong on the context line, e.g.30`Expected , or ) in SUM`.3132## Operators3334`+ - * / ^` for arithmetic, `&` to join text, `= <> < > <= >=` to compare35(giving TRUE or FALSE), `%` after a number divides by 100. Unary minus binds36tighter than `^` as in Sheets and Excel, so `=-2^2` is 4. 1-2-3's `#AND#`,37`#OR#` and `#NOT#` still work; `AND()`, `OR()` and `NOT()` are the Sheets way.3839Numbers are binary floating point, as in Sheets and Excel, and follow40Sheets where that shows:4142- Comparisons, and criteria such as `COUNTIF`'s, look at the 1543 significant digits a cell shows, so `=0.1+0.2=0.3` is TRUE. A44 difference itself keeps every digit: `=0.1+0.2-0.3` is 5.551E-1745 ([decimal arithmetic](decimal.md) makes it 0).46- A number written in a formula keeps 15 significant digits:47 `=123456789012345678` is 123456789012345000.48- A negative number has odd roots: `=(-8)^(1/3)` and `=POWER(-8, 1/3)`49 are -2; other fractional powers of it are `#NUM!`.5051## Values and errors5253Text in arithmetic is `#VALUE!` unless it reads as a number (`="3"*2` is 6);54blanks count as 0 or empty text. A condition (`IF`, `IFS`, `AND`, `OR`,55`NOT`) also reads the text `TRUE` or `FALSE`, and empty text as FALSE, so56`=IF("TRUE", 1, 2)` is 1. Aggregates such as `SUM` over a range skip57text; `COUNT` skips errors too and `COUNTA` counts them, where the others58give the first error in the range. Errors use Sheets' codes:5960| Error | Meaning |61|---|---|62| `#DIV/0!` | division by zero |63| `#VALUE!` | the wrong kind of value, e.g. text in arithmetic |64| `#NAME?` | an unknown name |65| `#REF!` | a reference to deleted cells, or a circular reference: every cell of the cycle, even one whose formula catches errors (`IFERROR`) or skips them (`COUNTIF`), and one reached only through an `IF` branch not taken or a part of a range the formula doesn't read (`INDEX`, `VLOOKUP`), as in Sheets |66| `#N/A` | not available, e.g. a lookup found nothing |67| `#NUM!` | a number out of range, e.g. `SQRT(-1)`, or a position outside what `CHOOSE`, `INDEX` or `MID` reads from, as in Sheets (Excel says `#VALUE!` or `#REF!`) |6869Error cells are red with a curly underline, and the context line explains the70active cell's error and where it came from, e.g.71`#DIV/0! From B3: division by zero in B5/0`, or names the chain of a72circular reference. An explanation longer than the line stops at the last73sentence that fits, with `…` and an F1 chip at the right: F1 shows the74whole of it in a box beside the cell, and any key closes it. F1 on a75cell without an error shows the keyboard shortcuts.7677## Regular expressions7879`REGEXMATCH`, `REGEXEXTRACT` and `REGEXREPLACE` use Go's regular80expressions, which are RE2, as Sheets' are: the same patterns mean the81same thing. They take text only: a number is `#VALUE!`, as in Sheets82(`A1&""` makes one text). `REGEXEXTRACT` returns the first83capture group, or the whole match without one, and spills several84groups across; `REGEXREPLACE` writes a group in the replacement as `$1`.85`SPLIT` spills the pieces of a text across, reading those that look like86numbers as numbers.8788## More8990| Page | For |91|---|---|92| [References](references.md) | Cells, ranges, names, other sheets, and a range where one value is wanted |93| [Building formulas](building.md) | Pointing, suggestions, argument hints |94| [Tracing formulas](tracing.md) | Precedents and dependents in the grid, and a formula evaluated step by step |95| [Arrays and spills](arrays.md) | FILTER, SORT, UNIQUE, SEQUENCE, ARRAYFORMULA, LET and LAMBDA |96| [Decimal arithmetic](decimal.md) | Exact decimal math for money |97| [JEV functions](jev.md) | Asking a hosted model from formulas |98| [Functions](../reference/functions.md) | Every function, generated from the engine |