The basic structure of the IF THEN ELSE
formula in Google sheets is an IF
formula with parameters, it looks like the following:
=IF(logical_expression; value_if_true; value_if_false)
NOTE: depending on your locale you may have to use comma (,
) instead of semicolon (;
) as separator for the parameters.
The first parameter is the expression that is evaluated to either be TRUE
or FALSE
, the second parameter is the value if the expression is TRUE
and the third parameter is the value if the expression is FALSE
.
For example the following will evaluate to 1
:
=IF(1=1; 1; 2)
and the following will evaluate to 2
:
=IF(1=2; 1; 2)
If the third parameter is missing the formula might output FALSE
if the expression is evaluated to false. For example the following will be FALSE
=IF(1=2; 1)
You can also use a cell as part of the formula:
=IF(A1>B1;A1;B1)
In the above, if A1
is bigger than B1
then we select A1
else B1
.
That is all!
I hope you found this helpful, please leave a comment down below if you have questions!