Presentation is loading. Please wait.

Presentation is loading. Please wait.

Conditional Logic Using Excel “IF” Statements. Logical TestIf TrueIf False Did you finish your dinner? You may have dessert. You may not have dessert.

Similar presentations


Presentation on theme: "Conditional Logic Using Excel “IF” Statements. Logical TestIf TrueIf False Did you finish your dinner? You may have dessert. You may not have dessert."— Presentation transcript:

1 Conditional Logic Using Excel “IF” Statements

2 Logical TestIf TrueIf False Did you finish your dinner? You may have dessert. You may not have dessert. Are you a registered voter? You may vote in the election. You may not vote in the election. Does the animal have a backbone? It is classified as a vertebrate. It is classified as an invertebrate. Do you want to mail the letter? You will need to get a stamp. You will not need to get a stamp. Some “plain-English” examples of conditional logic statements

3 My grading scale—(yours might be different) FromToLtr GradePass or Fail >=0%<59.5%FFail >=59.5%<69.5%DPass >=69.5%<79.5%CPass >=79.5%<89.5%BPass >=89.5%<=100%APass

4 Example 1: A simple conditional logic test Based on the grading scale shown in the previous slide, create a conditional logic statement that determines if each of the values in column K (“Pct of Tot Pts Possible”) represents a passing grade (“Pass”) or a failing grade (“Fail”), and store the results in column M ( “Pass or “Fail”). KLM 1Pct of Tot Pts Possible Ltr Grade Pass or Fail 2 89.6 3 73 459.4 579.8 667.2

5 The basic form of an “If” statement is: =IF(Logical Test is True,Then,Else)

6 Logical TestIf TrueIf False Is K2>=59.5?M2=PassM2=Fail =IF(K2>=59.5,“Pass","Fail") The conditional logic statement for the first case is: KLM 1Pct of Tot Pts Possible Ltr Grade Pass or Fail 2 89.6Pass 3 73 459.4 579.8 667.2

7 For the value in K2 (i.e., 73), the conditional logic statement would be: =IF(K2>=59.5,”Pass”,”Fail”) For the value in K3 (i.e., 89.6), the conditional logic statement would be: =IF(K3>=59.5,”Pass”,”Fail”) For the value in K4 (i.e., 59.4), the conditional logic statement would be: =IF(K4>=59.5,”Pass”,”Fail”) For the value in K5 (i.e., 79.8), the conditional logic statement would be: =IF(K5>=59.5,”Pass”,”Fail”) For the value in K6 (i.e., 67.2), the conditional logic statement would be: =IF(K6>=59.5,”Pass”,”Fail”) The conditional logic statements for all cases are: KLM 1Pct of Tot Pts Possible Ltr Grade Pass or Fail 2 89.6Pass 3 73Pass 459.4 Fail 579.8 Pass 667.2 Pass

8 Example 2: “Nested” conditional logic tests Based on the grading scale shown previously, create a conditional logic statement that will determine the letter grade for each of the values in column K (“Pct of Tot Pts Possible”), and store the results in column L (“Ltr Grade”). KLM 1Pct of Tot Pts Possible Ltr Grade Pass or Fail 2 89.6 3 73 459.4 579.8 667.2

9 =IF(K2>=89.5,"A",IF(K2>=79.5,"B",IF(K2>=69.5,"C",IF(K2>=59.5,"D","F")))) Displayed on the next four slides are its four ”nested” component parts… KLM 1Pct of Tot Pts Possible Ltr Grade Pass or Fail 2 89.6A 3 73 459.4 579.8 667.2 The conditional logic statement for the first case is:

10 Logical TestIf TrueIf False Is K2>=59.5?L2=DL2=F Is K2>=69.5?L2=CSteps in Blue Is K2>=79.5?L2=BSteps in Blue Is K2>=89.5?L2=ASteps in Blue =IF(K2>=89.5,"A",IF(K2>=79.5,"B",IF(K2>=69.5,"C",IF(K2>=59.5,"D","F")))) KLM 1Pct of Tot Pts Possible Ltr Grade Pass or Fail 2 89.6D 3 73 459.4 579.8 667.2

11 Logical TestIf TrueIf False Is K2>=59.5?L2=DL2=F Is K2>=69.5?L2=CSteps in Blue Is K2>=79.5?L2=BSteps in Blue Is K2>=89.5?L2=ASteps in Blue =IF(K2>=89.5,"A",IF(K2>=79.5,"B",IF(K2>=69.5,"C",IF(K2>=59.5,"D","F“)))) KLM 1Pct of Tot Pts Possible Ltr Grade Pass or Fail 2 89.6C 3 73 459.4 579.8 667.2

12 Logical TestIf TrueIf False Is K2>=59.5?L2=DL2=F Is K2>=69.5?L2=CSteps in Blue Is K2>=79.5?L2=BSteps in Blue Is K2>=89.5?L2=ASteps in Blue =IF(K2>=89.5,"A",IF(K2>=79.5,"B",IF(K2>=69.5,"C",IF(K2>=59.5,"D","F“)))) KLM 1Pct of Tot Pts Possible Ltr Grade Pass or Fail 2 89.6B 3 73 459.4 579.8 667.2

13 Logical TestIf TrueIf False Is K2>=59.5?L2=DL2=F Is K2>=69.5?L2=CSteps in Blue Is K2>=79.5?L2=BSteps in Blue Is K2>=89.5?L2=ASteps in Blue =IF(K2>=89.5,"A",IF(K2>=79.5,"B",IF(K2>=69.5,"C",IF(K2>=59.5,"D","F")))) KLM 1Pct of Tot Pts Possible Ltr Grade Pass or Fail 2 89.6A 3 73 459.4 579.8 667.2

14 For the value in K2 (i.e., 73), the conditional logic statement would be: =IF(K2>=89.5,"A",IF(K2>=79.5,"B",IF(K2>=69.5,"C",IF(K2>=59.5,"D","F")))) For the value in K3 (i.e., 89.6), the conditional logic statement would be: =IF(K3>=89.5,"A",IF(K3>=79.5,"B",IF(K3>=69.5,"C",IF(K3>=59.5,"D","F")))) For the value in K4 (i.e., 59.4), the conditional logic statement would be: =IF(K4>=89.5,"A",IF(K4>=79.5,"B",IF(K4>=69.5,"C",IF(K4>=59.5,"D","F")))) For the value in K5 (i.e., 79.8), the conditional logic statement would be: =IF(K5>=89.5,"A",IF(K5>=79.5,"B",IF(K5>=69.5,"C",IF(K5>=59.5,"D","F")))) For the value in K6 (i.e., 67.2), the conditional logic statement would be: =IF(K6>=89.5,"A",IF(K6>=79.5,"B",IF(K6>=69.5,"C",IF(K6>=59.5,"D","F")))) The conditional logic statements for all cases are: KLM 1Pct of Tot Pts Possible Ltr Grade Pass or Fail 2 89.6A 3 73C 459.4F 579.8B 667.2D

15 Some Important Things to Remember About Nested Conditional Logic Statements: You are limited to a maximum of 7 logical tests when creating nested conditional logic statements. Separate the 3 parameters for each conditional logic statement with commas. For each conditional logic statement, you must enclose its parameters inside a separate set of parenthesis. For each conditional logic statement, if the “then” and “else” parameters are fixed characters (like letters or numbers), enclose them in a pair of double quotes (i.e., “).


Download ppt "Conditional Logic Using Excel “IF” Statements. Logical TestIf TrueIf False Did you finish your dinner? You may have dessert. You may not have dessert."

Similar presentations


Ads by Google