IF formula

Tests a condition and returns one value if it's true, another if it's false. The building block for almost every other conditional formula in a spreadsheet.

Syntax

=IF(logical_test, value_if_true, [value_if_false])

Text results need quotation marks ("High"), while numbers and cell references don't. Leaving out the third argument means IF returns FALSE when the condition isn't met, which is rarely what you actually want — it's worth always including an explicit false-branch. For more than one condition, IF formulas can be nested inside each other, though past two or three levels a lookup table or IFS is usually easier to read and maintain.

Examples

=IF(A2>100,"High","Low")

Labels a value as High or Low depending on whether it's over 100.

=IF(B2="","Missing",B2*1.1)

Checks for a blank cell first, so a markup calculation doesn't run on an empty entry.

=IF(AND(A2>50,B2<10),"Flag","OK")

Combines IF with AND to only flag rows where both conditions are true at once.

Paste your own IF formula and get a plain-English explanation, or describe what you need and let FormulaFixer write it for you.

Explain an IF formula →

More formulas