1. Home
  2. Functions
  3. Logical
  4. IF

IF function

Returns one value when a condition is TRUE and another when it is FALSE.

Syntax

=IF(logical_test, value_if_true, [value_if_false])

Arguments

ArgumentRequiredDescription
logical_testRequiredThe condition to check
value_if_trueRequiredThe result when the condition is TRUE
value_if_falseOptionalThe result when it is FALSE (FALSE when left out)

How to use IF

IF takes 2 required arguments and 1 optional argument. Type =IF( in a cell and SheetsBat shows the arguments as you go. Optional arguments are shown in square brackets; leave them out to use their default.

Examples

Each result below was calculated by the SheetsBat formula engine.

=IF(5>3, "Yes", "No")Result "Yes"
=IF(1>3, "Yes")Result FALSE

Every formula, right in your browser

SheetsBat calculates 536 functions, with charts, pivot tables and live collaboration. Free to start.