If
IF Function¶
The IF function in Excel is one of the most fundamental logical functions. It checks whether a condition is met and returns one value if the condition is TRUE and another value if the condition is FALSE.
Syntax:¶
IF(logical_test, value_if_true, [value_if_false])
- logical_test: The condition you want to test.
- value_if_true: The value that is returned if the
logical_testisTRUE. - value_if_false (optional): The value that is returned if the
logical_testisFALSE. If omitted,FALSEis returned.
Examples:¶
=IF(A1 > 10, "High", "Low")checks if the value in cellA1is greater than 10. If it is, the function returns"High", otherwise, it returns"Low".=IF(B1 = "Apple", 5, 2)would return5if cellB1contains the word"Apple", and2otherwise.=IF(C1, "Done", "Not Done")assumesC1contains a logical value (TRUE or FALSE). It returns"Done"ifC1is TRUE and"Not Done"ifC1is FALSE.
Usage Notes:¶
- The
IFfunction is extremely versatile and can be nested to evaluate multiple conditions. - It is often used in combination with other functions like
AND,OR,MATCH, etc., to create more complex logical tests.
Note: Excel also provides
IFSfunction in newer versions, which can handle multiple conditions without requiring nestedIFstatements.