# IF Function

> Choose a result based on a logical test with the IF formula function of TX Sheet Control: true and false values, omitted arguments, errors and an example.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Function
- **Path:** TX Sheet Control > API Reference > Formula Functions > IF Function
- **232 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/if/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/if/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/if/llms-full.txt

---

Choose a result based on a logical test. `logical_test` is the condition; a number other than 0 counts as TRUE, and text that is not a logical value returns `#VALUE!`. IF returns `value_if_true` when the condition is true and `value_if_false` otherwise. When `value_if_false` is omitted, a false condition returns FALSE; when it is empty, it returns 0. An error in `logical_test` is returned unchanged.

### Syntax

```text
IF(logical_test, value_if_true, value_if_false)
```

Category: Logical. Minimum arguments: 2. Maximum arguments: 3.

Available for supported offline calculation.

### Examples

```text
=IF(10>5,"Yes","No")
```

The formula returns Yes, because 10 is greater than 5.

Cell and range examples require appropriate input values in the referenced cells. Handle invalid arguments, formula errors and array and spill constraints.

### See Also

- [Formulas](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/formulas/llms-full.txt)
- [Custom Functions and Formula Data](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/custom-functions/llms-full.txt)

---

## Nearby

- **Previous:** [HYPGEOMDIST Function](https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/hypgeomdist/llms-full.txt)
- **Next:** [IFERROR Function](https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/iferror/llms-full.txt)
