Returns one of two specified values if the specified condition evaluates to TRUE, and the other value if the condition evaluates to FALSE.
Syntax
![]() |
---|
IF( Logical condition, [Any ifTrue], [Any ifFalse] ) → Any |
If condition is TRUE, the function returns ifTrue, else it returns ifFalse. If there is only 1 parameter, ifTrue is considered to be TRUE. If there are less than 3 parameters, ifFalse is considered to be FALSE. Thus the 1 parameter version converts condition into a Logical value. If there are 2 or 3 parameters, but the second parameter is omitted (two consecutive commas), ifFalse is considered to be 0. If there are 3 parameters, but the third parameter is omitted, ifFalse is considered to be 0. This function only evaluates ifTrue, or ifFalse, and never both; that is to say, it short-circuits.
Formula
![]() |
---|
=IF(A1>B1,"Too many","OK") |
Function Reference
AND Function
OR Function