IF

returns one value if condition is true, another if false

signature

IF(condition, value_if_true, [value_if_false])

returns: any

argumentrequired
condition required
value_if_true required
value_if_false optional

examples

formula and result, taken from the engine's own test suite — every result below is asserted in CI, not written by hand.

A
1 10
fx =IF(A1>100, "High", "Low") Low
AB
1 102
fx =IF(A1>5, B1, 0) 2

related

  • AND returns TRUE if all arguments are true
  • FALSE returns the logical value FALSE
  • IFERROR returns value if no error, otherwise alternate
  • IFNA returns value if not #N/A, otherwise alternate
  • IFS checks multiple conditions, returns first match
  • NOT reverses the logic of its argument