Excel Function Reference

IF

Checks a condition and returns one value if it’s met and another if it isn’t.

IF(logical_test, value_if_true, [value_if_false])
  • [ ]optional part
logical_test
The condition: a comparison like B2>=60 or a function that returns TRUE or FALSE.
value_if_true
What to return if the condition is met.
value_if_false
What to return if it isn’t. If omitted, you get FALSE.
Optional

Return value

The value of the second argument if the condition is met, otherwise the value of the third. If the third argument is omitted, you get FALSE instead.

Examples

Pass or fail

fx
A
B
C
D
1
2
3
4
5
6
7
Student
Score
Result
Adams
72
Baker
58
Clark
60
Evans
45
Sheet1

Details

IF takes a condition, for example B2>=60, and two possible answers. An answer can be text in quotes, a number or another formula.

If there are more than two options, you nest IFs inside each other or use IFS. Check the conditions from the strictest to the loosest.

Common mistakes

  • Text in an answer without quotes: Excel looks for a function with that name and returns #NAME?.
  • The boundary of the condition: >60 doesn’t include 60 itself, while >=60 does.
  • In nested IFs the conditions are out of order, and a loose condition catches the strict cases first.

See also

Where to learn