---
title: "Use the IF Function to Return Values Based on Conditions"
slug: "if-function"
description: "Learn to use the IF function to test conditions in Pigment and return values based on TRUE, FALSE, or BLANK logic."
updated: 2026-01-13T12:02:59Z
published: 2026-01-13T12:02:59Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://kb.pigment.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IF function

## Description

Tests a Boolean argument and returns a value if the argument is True or another value if it is False or `BLANK`. Multiple IF functions can be nested to test multiple conditions at the same time.

## Syntax

`IF(Logical Test, Value if True [, Value if False or BLANK])`

## Arguments

| Argument | Type | Dimensions | Description |
| --- | --- | --- | --- |
| *Logical Test* (required) | Boolean | Any Dimensions | Boolean to test against that determines the values returned by the function. |
| *Value if True* (required) | Any | Any Dimensions | The return value if the corresponding *Logical Test* value is True. |
| *Value if False or BLANK* (optionnal) | Same as *Value if True* | Any Dimensions | The return value if the corresponding *Logical Test* value is False or `BLANK`. |

## Returns

| Type | Dimensions |
| --- | --- |
| Same Type as *Value if True* and *Value if False or BLANK* | All Dimensions of the three arguments |

The function accepts any sets of Dimensions on its arguments and Pigment automatically allocates missing Dimensions on arguments to make them match. The resulting set of Dimensions is the combination of all Dimensions used in the arguments. The formula bar provides Dimensionality Hints that list the resulting set of Dimensions. See [this article](/v1/docs/dimension-alignment-indicator) for more information.

## Examples

| Formula | Result | Description |
| --- | --- | --- |
| `IF(TRUE, 1, 0)` | 1 | The *Logical Test* is always True in this example so the result is expectedly 1. |
| `IF(Revenue &gt; 1000, “Large Account”, “SMB”)` | “Large Account” if the given Revenue is greater than 1000. “SMB” if the given Revenue is lesser or equal than 1000 or if the condition resolves as `BLANK`. |  |
| `IF(Revenue &gt; 1000, “Large Account”, IF(Revenue &lt; 300, “Small Account”, “Medium Account”))` | “Large Account” if the given Revenue is greater than 1000. “Small Account” if the given Revenue is lesser than 300. “Medium Account” if the given Revenue is between 300 and 1000 or if the condition resolves as `BLANK`. | Multiple nested IFs are used to test multiple conditions at the same time. |

## Example in a Complete Formula

Here are some examples of how to use IF with AND, OR, and NOT:

- **AND :**`IF(Country = Country."France" AND Revenue &gt; 1000, "Wow this is crazy good!")`
- **OR:**`IF(Country &lt;&gt; Country."France" OR Revenue &lt; 1000, "Not so great!") `
- **NOT:**`IF(NOT Country.'Has Sea Border', "No boats for you")`

> [!TIP]
> When using the NOT operator in formulas, keep in mind that `NOT(blank)` does not evaluate to `TRUE`—only `NOT(FALSE)` does. It's important to distinguish between `blank` and `FALSE`, as they can appear similar in cells with a Boolean data type.

## See also

Excel: [IF(logical_test, value_if_true, [value_if_false])](https://support.microsoft.com/en-us/office/if-function-69aed7c9-4e8a-4755-a9bc-aa8bbff73be2)

Related articles: [SWITCH](/v1/docs/switch-function)
