---
url: /set-instructions/apply-number-formatting-using-formula.md
description: Adds a number formatting to elements in the working set based on a formula
---

# Apply Number Formatting Using Formula

**Workview-only.** Sets the number format for each element in the working list using a formula, rather than a single fixed [Data Formatting](/set-instructions/data-formatting) instruction applied to everything. Useful when the correct format differs by element or by context.

| Argument | Type | Description |
| --- | --- | ------ |
| Formula | Formula | The formula to evaluate for each element in the working set |

#### Example

```
IF(ELEMENT("Account") = "Margin %", "0.0%", "#,##0")
```

Applies a percentage format to the `Margin %` row and a thousand-separated integer format to everything else, without needing to split the set into separate groups with an [Ignore New Formatting On Prior Members](/set-instructions/ignore-new-formatting-on-prior-members) boundary between them.

`"0.0%"` and `"#,##0"` are patterns from MODLR's general format syntax, not instruction-specific - see [MODLR Number Formats](/technical/modlr-formats) for the full reference, including patterns with no dedicated `Format` instruction (`#,##0k`/`m`/`b`, for example).

![Apply Number Formatting Using Formula applied per row - Revenue and Cost of Goods Sold get #,##0, Margin % alone gets 0.0%](/set-instructions-example-number-formatting-formula.svg)
