# Formula functions

A formula field calculates its value from other fields. A function name can be written in capitals or in small letters. In the formula editor, point at a function under **Functions** to see what it does.

In a calculation such as `+`, `*` or `ROUND`, an empty value makes the result empty. A division by 0 is empty too. There are three exceptions:

- Tracked time with nothing logged counts as 0.
- `IF` with an empty first value gives its third value.
- `ISEMPTY`, `HAS` and `ANYOF` always give 1 or 0.

## Numbers

| Function | Returns | Example |
|---|---|---|
| `ROUND` | The number rounded to the given decimal places, 0 when left out | `ROUND({Estimate (h)} * 1.2, 1)` |
| `FLOOR` | The number rounded down to a whole number | `FLOOR({Estimate (h)})` |
| `CEIL` | The number rounded up to a whole number | `CEIL({Estimate (h)})` |
| `ABS` | The number without its sign | `ABS({Estimate (h)} - {Tracked Time (h)})` |
| `MIN` | The smallest of its values | `MIN({Estimate (h)}, 40)` |
| `MAX` | The largest of its values | `MAX({Estimate (h)}, 1)` |
| `SUM` | Its values added together | `SUM({Design}, {Build}, {Test})` |
| `AVG` | The average of its values | `AVG({Design}, {Build})` |

## Rates

| Function | Returns | Example |
|---|---|---|
| `RATE` | The hourly cost rate of the item's assignees today. Several assignees give their average. An item nobody is assigned to uses the organization default. Empty when an assignee has no rate | `{Estimate (h)} * RATE()` |

- No field holds the cost rate. In the formula editor, **Cost rate** under **Fields** adds `RATE()` to the formula.
- A formula that uses `RATE`, directly or through another formula, shows only to a role that may read financial data and time logs. Everyone else sees a dash, and a filter on it is not applied for them.
- A formula that uses **Budget**, directly or through another formula, shows only to a role that may read financial data. Everyone else sees a dash, and a filter on it is not applied for them.
- `ROLLUP` cannot read a formula that uses `RATE`. The field's own roll-up still totals it in a view.
- A formula that uses `RATE` cannot be the source of a field copy, and an automation cannot use `RATE`.

## Conditions and select fields

| Function | Returns | Example |
|---|---|---|
| `IF` | The second value when the first is not 0, otherwise the third | `IF({Estimate (h)} > 40, 1, 0)` |
| `ISEMPTY` | 1 when a select field holds no option, otherwise 0 | `ISEMPTY({Priority})` |
| `HAS` | 1 when a select field holds the named option, otherwise 0 | `HAS({Priority}, "Critical")` |
| `ANYOF` | 1 when a select field holds any of the named options, otherwise 0 | `ANYOF({Priority}, "High", "Critical")` |

## Dates

| Function | Returns | Example |
|---|---|---|
| `DATEADD` | A date moved by a number of days, weeks, months or years | `DATEADD({Due date}, 7, "days")` |
| `DATEDIFF` | The days or weeks from the second date to the first | `DATEDIFF({Due date}, TODAY(), "days")` |
| `TODAY` | The date today | `TODAY()` |
| `DATE` | A fixed date, written as year, month and day | `DATE("2026-12-31")` |
| `YEAR` | The year of a date | `YEAR({Due date})` |
| `MONTH` | The month of a date, from 1 to 12 | `MONTH({Due date})` |
| `DAY` | The day of the month of a date | `DAY({Due date})` |
| `WEEKDAY` | The day of the week, from 1 for Monday to 7 for Sunday | `WEEKDAY({Due date})` |
| `STARTOFMONTH` | The first day of the month a date is in | `STARTOFMONTH({Due date})` |
| `ENDOFMONTH` | The last day of the month a date is in | `ENDOFMONTH({Due date})` |

## Values from the items below

| Function | Returns | Example |
|---|---|---|
| `ROLLUP` | A field rolled up over the item and every item below it | `ROLLUP({Estimate (h)}) - ROLLUP({Tracked Time (h)})` |

- `ROLLUP` takes exactly one field reference. The field must be a number field, a tracked time field, or a formula whose result is a number.
- A calculation, the **Cost** field and a nested `ROLLUP` are refused. To roll up a calculation, roll up a formula field that holds it.
- The result follows the field's own **Rollup** setting. Tracked time is returned in hours.

## Next

- [How values roll up to a parent](../../how-it-works/rollups/)
- [What is a field?](../what-is-a-field/)
