Teach MeShow MeLet Me TryPrint

Creating Formulas Using the If Function

The IF logical function will return one value if a condition is true and another value if the condition is false. Use the IF function when you want to compare two items in your workbook. The IF function looks like this:
=IF(logical_test,value_if_true,
value_if_false)

To use the IF Function:

  1. Select the cell in which you want to enter the function.
  2. Click the Insert Function button.
  3. Click IF from the list of Logical functions and click OK.
  4. Enter the Logical_test argument. This argument states the condition you want to test for. Use cell references and/or values with logical operators. For example, B5<D7 will return true if B5 is less than D7 and false if B5 is not less than D7.
  5. Enter the value_if_true argument. This is the text string or value that will be displayed if the Logical_test argument is true.
  6. Enter the value_if_false argument. This is the text string or value that will be displayed if the Logical_test argument is false.
  7. Click OK.

Logical operators are used to compare numbers in two or more cells to a constant. The logical operators for the IF function are:

=      Equal to
<      Less than
>      Greater than
≤      Less than or equal to
≥      Greater than or equal to
≠       Not equal to
NOT   Logical Not
AND   Logical And
OR     Logical Or

To open the Insert Function box, you can also: