IF Function in Google Sheets

Perform conditional logic in Google Sheets using the IF function.

IF Function

The IF function in Google Sheets returns one value if a logical expression is TRUE and another if it is FALSE.

Syntax

IF(logical_expression, value_if_true, value_if_false)

Examples

  1. Basic IF Statement

Check if a number is greater than 10:

=IF(A1 > 10, "Yes", "No")

This will output ‘Yes’ if A1 is greater than 10, otherwise ‘No’.

  1. Nested IF Statements

Return ‘Excellent’, ‘Good’, or ‘Poor’ based on a score:

=IF(A1 > 90, "Excellent", IF(A1 > 75, "Good", "Poor"))

This will output ‘Excellent’ if A1 is greater than 90, ‘Good’ if greater than 75, otherwise ‘Poor’.

Notes

  • The IF function is essential for applying logic in your spreadsheet.
  • It can be nested to handle multiple conditions.
  • IFS: Returns a value from the first TRUE condition in a list.
  • SWITCH: Evaluates an expression against a list of values and returns the corresponding result.