The IF function

Returns one value when a test is TRUE and another when it is FALSE. Put text results in double quotes.

Syntax

IF(logical_test, [value_if_true], [value_if_false])
logical_test
A comparison that is TRUE or FALSE, such as A2>=50.
value_if_true (optional)
What to return when the test is TRUE.
value_if_false (optional)
What to return when the test is FALSE.

Examples

C1=IF(A2>=50,"Pass","Fail")
ABC
1ScorePass
262

In plain words: If the score in A2 is 50 or more, show Pass. Otherwise show Fail.

C1=IF(A2>100,A2*0.1,0)
ABC
1Score0
262

Practice IF

Read the guide

Questions

How many IFs can I nest?

Excel allows 64, but past three or four the formula is hard to read. Use IFS, or a lookup table with VLOOKUP or XLOOKUP, instead.

Related functions