1 / 30

Computer Science & Engineering 2111

Computer Science & Engineering 2111. Lecture 3 IF and Boolean Functions. 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 ])

gilead
Download Presentation

Computer Science & Engineering 2111

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Science & Engineering 2111 Lecture 3 IF and Boolean Functions CSE 2111 Lecture 3-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 CSE 2111 Lecture 3-IF and Boolean Functions

  3. CSE 2111 Lecture 3-IF and Boolean Functions

  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 7 times. CSE 2111 Lecture 3-IF and Boolean Functions

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

  6. IF with a range CSE 2111 Lecture 3-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 CSE 2111 Lecture 3-IF and Boolean Functions

  8. CSE 2111 Lecture 3-IF and Boolean Functions

  9. CSE 2111 Lecture 3-IF and Boolean Functions

  10. CSE 2111 Lecture 3-IF and Boolean Functions

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

  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. CSE 2111 Lecture 3-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. CSE 2111 Lecture 3-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 300. CSE 2111 Lecture 3-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) =AND(Scores!E5>=Scores!B2, Scores!E6>=Scores!B2,Scores!E7>=Scores!B2) CSE 2111 Lecture 3-IF and Boolean Functions

  16. Write a formula in cell Statistics!F6 to determine T/F if all the students are honors students. 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”) CSE 2111 Lecture 3-IF and Boolean Functions

  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. CSE 2111 Lecture 3-IF and Boolean Functions

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

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

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

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

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

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

  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. CSE 2111 Lecture 3-IF and Boolean Functions

  25. Scores New Stats CSE 2111 Lecture 3-IF and Boolean Functions

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

  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” =IF(AND(Scores!F5:F7),"All Honor Students", "Not Everyone is an Honors student") CSE 2111 Lecture 3-IF and Boolean Functions

  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” =IF(AND(Scores!E5>Scores!E7,Scores!E6>Scores!E7), "Led and Rob", "Rascal") CSE 2111 Lecture 3-IF and Boolean Functions

  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” =IF(OR(Scores!E5>=Scores!B2,Scores!E6>=Scores!B2,Scores!E7>=Scores!B2),"At least one passed", "No One passed") CSE 2111 Lecture 3-IF and Boolean Functions

  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”) =IF(OR(Scores!F5:F7),"At least one Honors student", "No Honor students") CSE 2111 Lecture 3-IF and Boolean Functions

More Related