---
title: Formula reference
description: Every function and operator you can use in the logic formula editor.
icon: square-function
search:
  keywords: [formula, expression, functions, if, and, or, answer, syntax]
---

The formula editor lets you write logic as text, like a spreadsheet formula. Open it from any logic rule with **Edit formula**. As you type, it checks the formula. Click **Preview with answers** to try it with test answers before you **Apply formula**.

```text
if(answer("Age") >= 18, show_question("Driving licence"), end_form())
```

## Referencing questions

Use `answer("Question")` with the question's title. If two questions share a title, Finerlise adds the question's ID: `answer("Name", "fld_123")`.

## Logic

| Function | Syntax | What it does |
| --- | --- | --- |
| If | `if(condition, then_action, else_action)` | Runs one action when the condition matches, and an optional other action when it doesn't. |
| And | `condition and condition` | True only when every condition is true. |
| Or | `condition or condition` | True when at least one condition is true. |
| Not | `not condition` | Flips a condition. |

Use parentheses to group conditions: `(a and b) or c`.

## Comparisons

| Operator   | Meaning                                                  |
| ---------- | -------------------------------------------------------- |
| `==`       | Equals                                                   |
| `!=`       | Does not equal                                           |
| `>` / `>=` | Greater than / greater than or equal (numbers and dates) |
| `<` / `<=` | Less than / less than or equal (numbers and dates)       |

## Checks

| Function | Syntax | What it does |
| --- | --- | --- |
| Contains | `contains(answer("Question"), "value")` | True when text or selected options include the value. |
| Empty | `empty(answer("Question"))` | True when the question wasn't answered. |

## Actions

| Function | Syntax | What it does |
| --- | --- | --- |
| Show question | `show_question("Question")` | Shows a block. |
| Hide question | `hide_question("Question")` | Hides a block. |
| Hide answers | `hide_choices("Question", "answer")` | Hides some options of a choice question. |
| Add | `add("Variable", 1)` | Adds a number, or another answer, to a calculated field. |
| Show page | `show_page("Page")` | Reveals a page that's hidden by logic. |
| Jump to page | `jump_to_page("Page")` | Skips to a later page. |
| Show end page | `show_end_page("End page")` | Submits and shows a specific end page. |
| End form | `end_form()` | Submits and shows the default end page. |
| Redirect | `redirect("https://example.com")` | Submits and sends the respondent to a URL. |

## Examples

```text
if(contains(answer("How did you hear about us?"), "Instagram"), show_question("Instagram handle"))
```

```text
if(empty(answer("Company")) or answer("Team size") < 5, show_end_page("Self-serve"))
```

:::tip Click **Debug** to see an evaluation trace, which shows step by step how your formula was worked out. :::
