Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Science & Engineering 2111 IF and Boolean Functions 1 CSE 2111 Lecture-IF and Boolean Functions.

Similar presentations


Presentation on theme: "Computer Science & Engineering 2111 IF and Boolean Functions 1 CSE 2111 Lecture-IF and Boolean Functions."— Presentation transcript:

1 Computer Science & Engineering 2111 IF and Boolean Functions 1 CSE 2111 Lecture-IF and Boolean Functions

2 IF FUNCTION Checks to see if a condition is true or false. If true one thing happens, if false another thing happens IF this is true, do this, else do this. =IF(logical test, value_if_true, [value_if_false]) Logical test must evaluate to true or false 2 CSE 2111 Lecture-IF and Boolean Functions

3 3

4 NESTED IF IF this is true, do this, else IF this is true, do this, else, do this. =if(this = true, do this, else if(this = true, do this, otherwise do this)) Can be nested up to 30 times. 4 CSE 2111 Lecture-IF and Boolean Functions

5 Assume no student has the same score. CSE 2111 Lecture-IF and Boolean Functions 5

6 IF with a range 6 CSE 2111 Lecture-IF and Boolean Functions

7 Using Boolean functions =AND(logical1, [logical2], …) Returns true if all arguments evaluate to true =OR(logical1, [logical2], …) Returns true if at least one argument evaluates to true =NOT(logical) Changes false to true and true to false 7 CSE 2111 Lecture-IF and Boolean Functions

8 8

9 9

10 10

11 CSE 2111 Lecture-IF and Boolean Functions 11 Scores Statistics

12 Write a formula in cell Statistics!F2 to determine T/F if Led Zeppelin’s total score is higher than Rob Thomas’ total score. 12 CSE 2111 Lecture-IF and Boolean Functions

13 Write a formula in cell Statistics!F3 to determine T/F if Rob Thomas’ total score is the maximum in the class. 13 CSE 2111 Lecture-IF and Boolean Functions

14 Write a formula in cell Statistics!F4 to determine T/F if the average total score of all students is less than CSE 2111 Lecture-IF and Boolean Functions

15 Write a formula in cell Statistics!F5 to determine T/F if everyone passed the class. (A passing score is 320) 15 CSE 2111 Lecture-IF and Boolean Functions =AND(Scores!E5>=Scores!B2, Scores!E6>=Scores!B2,Scores!E7>=Scores!B2)

16 Write a formula in cell Statistics!F6 to determine T/F if all the students are honors students. 16 CSE 2111 Lecture-IF and Boolean Functions DON’T DO THIS =AND(Scores!F5=True,Scores!F6=True,Scores!F7=True) AND REALLY, DON’T DO THIS =AND(Scores!F5=“True”,Scores!F6=“True”,Scores!F7=“True”)

17 Write a formula in cell Statistics!F7 to determine T/F if Led Zeppelin’s total score and Rob Thomas’ total score is greater than Rascal Flat’s total score. 17 CSE 2111 Lecture-IF and Boolean Functions

18 Write a formula in cell Statistics!F8 to determine T/F if as least one person passed the class. 18 CSE 2111 Lecture-IF and Boolean Functions =OR(Scores!E5>=Scores!B2, Scores!E6>=Scores!B2,Scores!E7>=Scores!B2)

19 Write a formula in cell Statistics!F9 to determine T/F if at least one person is an honors student. 19 CSE 2111 Lecture-IF and Boolean Functions

20 Write a formula in cell Statistics!F10 to determine T/F if Led Zeppelin is not an honors student. 20 CSE 2111 Lecture-IF and Boolean Functions

21 Write a formula in cell Statistics!F11 to determine T/F if none of the students are honors students. 21 CSE 2111 Lecture-IF and Boolean Functions =NOT(F9) Another possible answer: =AND(NOT(Scores!F5), NOT(Scores!F6),NOT(Scores!F7))

22 Write a formula in cell Statistics!F12 to determine T/F if none of the students passed the course. 22 CSE 2111 Lecture-IF and Boolean Functions =NOT(F8) Another possible answer: =NOT(OR(Scores!E5>=Scores!B2, Scores!E6>=Scores!B2, Scores!E7>=Scores!B2))

23 Write a formula in cell Statistics!F13 to determine T/F if only Led Zeppelin passed the course. 23 CSE 2111 Lecture-IF and Boolean Functions =AND(Scores!E5>=Scores!B2,NOT(F8)) Another possible answer: =AND(Scores!E5>=Scores!B2, NOT(OR(Scores!E6>=Scores!B2, Scores!E7>=Scores!B2)))

24 Write a formula in cell Statistics!F14 to determine T/F if Rob Thomas’ score is at least 15 points higher than Rascal Flat’s Total Score. 24 CSE 2111 Lecture-IF and Boolean Functions

25 25 Scores New Stats

26 Write a formula in cell New Stats!F2 to determine if everyone passed the class. (A passing score is 320) Display the text, “Everyone”, or “Not Everyone” 26 CSE 2111 Lecture-IF and Boolean Functions =IF(AND(Scores!E5>=Scores!B2,Scores!E6>=Scores!B2, Scores!E7>=Scores!B2),"Everyone", "Not Everyone")

27 Write a formula in cell New Stats!F3 to determine if all the students are honors students. Display the text, “All Honor Students”, or “Not Everyone is an Honor’s student” 27 CSE 2111 Lecture-IF and Boolean Functions =IF(AND(Scores!F5:F7),"All Honor Students", "Not Everyone is an Honors student")

28 Write a formula in cell New Stats!F4 to determine if Led Zeppelin’s total score and Rob Thomas’ total score is greater than Rascal Flat’s total score. Display the text, “Led and Rob”, or Rascal” 28 CSE 2111 Lecture-IF and Boolean Functions =IF(AND(Scores!E5>Scores!E7,Scores!E6>Scores!E7), "Led and Rob", "Rascal")

29 Write a formula in cell New Stats!F5 to determine if at least one person passed the class. Display the text, “At least one passed” or “No One passed” 29 CSE 2111 Lecture-IF and Boolean Functions =IF(OR(Scores!E5>=Scores!B2,Scores!E6>=Scores!B2,Scores! E7>=Scores!B2),"At least one passed", "No One passed")

30 Write a formula in cell New Stats!F6 to determine if at least one person is an honors student. Display the text, “At least one Honors student”, or “No Honor students”) 30 CSE 2111 Lecture-IF and Boolean Functions =IF(OR(Scores!F5:F7),"At least one Honors student", "No Honor students")


Download ppt "Computer Science & Engineering 2111 IF and Boolean Functions 1 CSE 2111 Lecture-IF and Boolean Functions."

Similar presentations


Ads by Google