120 likes | 185 Views
Computer Science & Engineering 2111. IF Function. 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 ])
E N D
Computer Science & Engineering 2111 IF Function CSE 2111 Lecture-IF Function
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-IF Function
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. CSE 2111 Lecture-IF Function
Assume no student has the same score. CSE 2111 Lecture-IF Function
IF with a range CSE 2111 Lecture-IF Function
Scores New Stats CSE 2111 Lecture-IF Function
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-IF Function
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-IF Function
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-IF Function
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-IF Function
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-IF Function