Pepelen

Build decisions of the form “if the condition is true, one result; otherwise, another,” including decisions with several thresholds, using nesting.

1 / 6

How IF works

The IF function: syntax and how it works

The IF function lets you choose one of two values depending on a condition. Syntax: =IF(condition, value_if_true, value_if_false). For example: =IF(A1>50, "Passed", "Failed") — if A1 is greater than 50, the cell shows “Passed”; otherwise, “Failed”. Comparison operators: > (greater than), < (less than), >= (greater than or equal to), <= (less than or equal to), = (equal to), <> (not equal to). A text result must always be in quotation marks: "Excellent". A numeric result goes without quotes: =IF(B2>=5, 1, 0). When there are several thresholds, IFs are nested inside each other. For example, a grade from a score: =IF(A1>=90, "Excellent", IF(A1>=75, "Good", IF(A1>=60, "Fair", "Poor"))). Important: the checks go from the highest threshold to the lowest — as soon as one condition is true, Excel stops and doesn't check the rest. In the US version of Excel, arguments are separated by commas; some other language versions use semicolons. In this course, always type the English name: IF.
Lesson notes
The IF function: syntax and how it works
The IF function lets you choose one of two values depending on a condition. Syntax: =IF(condition, value_if_true, value_if_false). For example: =IF(A1>50, "Passed", "Failed") — if A1 is greater than 50, the cell shows “Passed”; otherwise, “Failed”. Comparison operators: > (greater than), < (less than), >= (greater than or equal to), <= (less than or equal to), = (equal to), <> (not equal to). A text result must always be in quotation marks: "Excellent". A numeric result goes without quotes: =IF(B2>=5, 1, 0). When there are several thresholds, IFs are nested inside each other. For example, a grade from a score: =IF(A1>=90, "Excellent", IF(A1>=75, "Good", IF(A1>=60, "Fair", "Poor"))). Important: the checks go from the highest threshold to the lowest — as soon as one condition is true, Excel stops and doesn't check the rest. In the US version of Excel, arguments are separated by commas; some other language versions use semicolons. In this course, always type the English name: IF.
The IF function and nested IFs — Excel from Scratch: Formulas, Functions, and Data Analysis