Logiceasy

IF()

Returns one value if a condition is TRUE, another if FALSE.

Syntax
fx
=IF(logical_expression, value_if_true, value_if_false)
Try it
F2
→
Big quarter
Sample data · sales.csv
ABCD
1CompanyRegionQuarterRevenue
2Acme CoWestQ118,400
3Acme CoWestQ222,100
4Acme CoWestQ331,700
5Acme CoWestQ448,200
6GlobexEastQ114,200
7GlobexEastQ219,800
8GlobexEastQ323,400

Common pitfalls

  • Nested IFs become unreadable past 2-3 levels. Reach for IFS or SWITCH instead.
  • Both branches are evaluated lazily, so you can safely return 1/0 or other errors in unused branches without breaking the formula.
  • For multiple conditions, use AND / OR inside the test rather than nesting IFs.
Related formulas
IFS()
Evaluates multiple conditions and returns a value for the first TRUE.
IFERROR()
Returns the first argument if it isn't an error; otherwise returns the second.
AND()
Returns TRUE if all of the provided arguments are logically true.
OR()
Returns TRUE if any of the provided arguments are logically true.
Used by
IFS()
Evaluates multiple conditions and returns a value for the first TRUE.
IFERROR()
Returns the first argument if it isn't an error; otherwise returns the second.
IFNA()
Returns the first argument unless it is the #N/A error, in which case returns the second.
AND()
Returns TRUE if all of the provided arguments are logically true.
OR()
Returns TRUE if any of the provided arguments are logically true.
NOT()
Returns the opposite of a logical value: NOT(TRUE) = FALSE.