12
Computer Science & Engineering 2111 IF Function 1 CSE 2111 Lecture-IF Function

Computer Science & Engineering 2111

Embed Size (px)

DESCRIPTION

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 ]) - PowerPoint PPT Presentation

Citation preview

1

Computer Science & Engineering 2111

Computer Science & Engineering 2111IF Function

CSE 2111 Lecture-IF Function

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-IF Function

3CSE 2111 Lecture-IF Function

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.

CSE 2111 Lecture-IF Function

5

Assume no student has the same score.

CSE 2111 Lecture-IF Function

6

IF with a range

CSE 2111 Lecture-IF Function

7CSE 2111 Lecture-IF Function

Scores

New Stats

8

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”

CSE 2111 Lecture-IF Function

=IF(AND(Scores!E5>=Scores!B2,Scores!E6>=Scores!B2,Scores!E7>=Scores!B2),"Everyone", "Not Everyone")

9

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”

CSE 2111 Lecture-IF Function

=IF(AND(Scores!F5:F7),"All Honor Students", "Not Everyone is an Honors student")

10

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”

CSE 2111 Lecture-IF Function

=IF(AND(Scores!E5>Scores!E7,Scores!E6>Scores!E7), "Led and Rob", "Rascal")

11

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”

CSE 2111 Lecture-IF Function

=IF(OR(Scores!E5>=Scores!B2,Scores!E6>=Scores!B2,Scores!E7>=Scores!B2),"At least one passed", "No One passed")

12

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”)

CSE 2111 Lecture-IF Function

=IF(OR(Scores!F5:F7),"At least one Honors student", "No Honor students")