{"id":11148,"date":"2022-08-01T19:27:21","date_gmt":"2022-08-01T19:27:21","guid":{"rendered":"https:\/\/officetuts.net\/excel\/?p=11148"},"modified":"2024-03-29T14:12:04","modified_gmt":"2024-03-29T14:12:04","slug":"produce-multiple-outputs-in-an-if-statement","status":"publish","type":"post","link":"https:\/\/officetuts.net\/excel\/formulas\/produce-multiple-outputs-in-an-if-statement\/","title":{"rendered":"Produce Multiple Outputs in an IF Statement in Excel"},"content":{"rendered":"\n
Produce-Multiple-Outputs-in-an-IF-Statement<\/a>Download File<\/a><\/div>\n\n\n\n

The Excel IF<\/strong> function checks whether a condition is met, and returns one value if TRUE<\/strong>, and another value if FALSE<\/strong>.<\/p>\n\n\n\n

The syntax of the function is:<\/p>\n\n\n\n

IF(logical_test, [value_if_true], [value_if_false])<\/strong><\/p>\n\n\n\n

By default, the function has only two outcomes but there are some situations when we may want multiple or more than two outcomes.<\/p>\n\n\n\n

We can achieve multiple outputs using the IF<\/strong> statement by nesting the IF<\/strong> functions and using the IF statement together with other Excel functions such as the AND logical function and the OR logical function.<\/p>\n\n\n\n

In this tutorial, we will use five examples to explain how we can produce multiple outputs in an IF statement.<\/p>\n\n\n\n

Example 1: Use the multiple nested IF functions<\/h2>\n\n\n\n

In this example, we will use two datasets. The first dataset is a school\u2019s grading system.<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

The second dataset is a student\u2019s scores in a certain subject. Letter grades need to be assigned to the scores according to the school\u2019s grading system.<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

To assign letter grades to the scores, we do the following:<\/p>\n\n\n\n

    \n
  1. Select cell C2<\/strong> and type in the formula:<\/li>\n<\/ol>\n\n\n\n
     =IF(B2<=79,\"D\",IF(B2<=87,\"C\",IF(B2<=93,\"B\",\"A\")))<\/code><\/pre>\n\n\n\n
    \"\"<\/figure>\n\n\n\n
      \n
    1. Press the Enter key and double-click or drag down the fill handle to copy the formula down the column.<\/li>\n<\/ol>\n\n\n\n
      \"\"<\/figure>\n\n\n\n

      The letter grades are assigned to the various scores.<\/p>\n\n\n\n

      Explanation of the formula<\/strong><\/p>\n\n\n\n

      =IF(B2<=79,\"D\",IF(B2<=87,\"C\",IF(B2<=93,\"B\",\"A\")))<\/code><\/pre>\n\n\n\n