IF Function: syntax, examples, mistakes and translation notes
Returns one value when a test is true and another when false.
Syntax
=IF(logical_test, value_if_true, [value_if_false])
Arguments
logical_test
Condition that evaluates to TRUE or FALSE.
value_if_true
Value or expression returned when the test is TRUE.
value_if_false
Optional fallback when the test is FALSE.
Worked examples
=IF(82>=70,"Pass","Review")
Returns “Pass” because 82 is at least 70.
=IF(C2="","Missing",C2)
Labels a blank C2 without changing nonblank values.
Practical tips
- Keep the logical test simple enough to audit separately.
- Use AND or OR when several conditions belong to the same decision.
- For many sequential conditions, IFS or a lookup table can be easier to maintain.
Common mistakes
- Deeply nesting IF statements until the decision path is hard to trace.
- Comparing numbers stored as text and assuming the comparison behaves like numeric data.
Related functions
Frequently asked questions
What does IF do?
Returns one value when a test is true and another when false.
Why might a IF formula return an unexpected result?
Deeply nesting IF statements until the decision path is hard to trace. Start by testing the smallest referenced range or condition independently before adding wrappers or fallbacks.
Check the complete formula
Function syntax is only one part of a working workbook. Paste the finished expression into the Formula Checker for structural warnings, the Formatter for readability or the Translator when a supported locale mapping is involved.
Testing note: examples are educational. Spreadsheet versions, locale settings, tables, named ranges and workbook data can change behavior, so validate important formulas with representative data.