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

Slides:



Advertisements
Similar presentations
Excel IF Functions The IF function is one of Excels most useful and most used functions. What it does, basically, is test to see whether a certain condition.
Advertisements

Decision Structures - If / Else If / Else. Decisions Often we need to make decisions based on information that we receive. Often we need to make decisions.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 5 Selection Statements.
CIS100 Test Review Dale McIntosh © 2009 Dale McIntosh. All Rights Reserved.Fall 2009.
Pasewark & Pasewark Microsoft Office XP: Introductory Course 1 INTRODUCTORY MICROSOFT EXCEL Lesson 5 – Function Formulas.
Lesson 3 Working with Formulas.
CIS100 Test 2 Review REACH CRC © 2011 REACH CRC. All Rights Reserved.Spring 2011.
Spreadsheet Software (Advanced Topics) Microsoft Excel.
MS-Excel XP Lesson 5. Exponentiation 1.A1  2 A2  3 A3  =A1^A2 B1  =2^4 2.^ for exponentiation.
REACH CRC © 2011 REACH CRC. All Rights Reserved.Fall 2011.
Introduction to Excel Formulas, Functions and References.
MONTEGO BAY HIGH SCHOOL INFORMATION TECHNOLOGY THE EXCEL IF FUNCTION.
Computer Science & Engineering 2111 CONDITIONAL STATISTICAL FUNCTIONS 1 CSE 2111 Lecture Conditional Statistical Functions.
情報基礎 B Lecture 5 Takeshi Tokuyama Tohoku University Graduate School of Information Sciences System Information Sciences Design and Analysis of Information.
CS&E 1111 ExIFs IFs and Nested IFs in Excel Objectives: Using the If function in spreadsheets Nesting If functions.
Selection (decision) control structure Learning objective
Objectives AND logic OR logic Evaluating compound conditions with multiple logical operators Precedence when combining AND and OR operators Efficiency.
Chap 4 Formulas and Functions Exploring Spreadsheet Software.
Selection Structures Tonga Institute of Higher Education.
1 Selection in C. 2 If / else if statement:  The else part of an if statement can be another if statement. if (condition) … else if (condition) … else.
Eight compound procedures and higher-order procedures.
1 Excel Lesson 5 Using Functions Microsoft Office 2010 Introductory Pasewark & Pasewark.
ACOT Intro/Copyright Succeeding in Business with Microsoft Excel 2010: Chapter1.
1 Selection Structures. 2 Making Decisions Sample assignment statements to figure worker pay with possible overtime PayAmount = Hours * Rate PayAmount.
Programming with MATLAB. Relational Operators The arithmetic operators has precedence over relational operators.
Selection in C.
1 Excel Lesson 5 Using Functions Microsoft Office 2010 Introductory Pasewark & Pasewark.
1 Agenda – 9/20/2013/ Monday Howard J Rattliff, Jr. – Principles of Technology - Course #
Lesson 4 Cell Reference Formulas. Working with Cell References continued… Relative Cell Reference A relative cell reference means that the cell value.
Data Analysis Formula and Functions. Formula and functions A function is a calculation in a spreadsheet that has or can be memorized. There are many different.
Pasewark & Pasewark Microsoft Office 2003: Introductory 1 INTRODUCTORY MICROSOFT EXCEL Lesson 5 – Function Formulas.
1 Spreadsheets SELECTION. 2 Aims  Understand the principles of selection in Excel  Examine the basic IF statement format  Look into Nested IF statements.
1. Common Functions 2.
Selection Structure If... Then.. Else Case. Selection Structure Use to make a decision or comparison and then, based on the result of that decision or.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.
CS105 Fall CS105 Lab 3 – Excel: The IF Function Announcements MP 1 will be released on Monday 9/14, due Monday 9/28 by 9pm Midterm 1 on Tuesday 9/29.
Lesson 5: Working with Formulas and Functions Logical and 3D Formulas.
CS&E 1111 ExLogic Microsoft Excel Logical Functions Objectives: Using Boolean Logic in Spreadsheets l Relational operators l Boolean operators –Functions.
# 1# 1 Error Messages, VLookup, Practical Tips What use is VLookup? How do you error check in Excel? CS 105 Spring 2010.
Unit 4, Lesson 4 Using Function Formulas. Objectives Understand function formulas. Understand function formulas. Use the Average and Sum functions. Use.
ITEC 109 Lecture 11 While loops. while loops Review Choices –1 st –2 nd to ?th –Last What happens if you only use ifs? Can you have just an else by itself?
1 Excel Lesson 3 Using Functions Microsoft Office 2010 Introductory Pasewark & Pasewark.
More Spreadsheets Range Formulas & Empty Cells Logical Functions Lookup Functions.
Are used in higher-level operations, such as conditional and comparison equations to compute interest rates, due dates and payment terms, and financial.
Advanced Functions SET 153L. Logical Function An IF function can place different values in a cell based on some condition. =IF (test, value if true, value.
Chapter 2 Excel Fundamentals Logical IF (Decision) Statements Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
CIS 100 Test #2 Review 1. EXCEL Functions on Test  SUM, COUNT, COUNTA, MAX, MIN, MEDIAN, MODE, AVERAGE, ROUND, and IF  Possibly Others 
Variables, operators, canvas, and multimedia Dr. Reyes.
Control Flow (Python) Dr. José M. Reyes Álamo. 2 Control Flow Sequential statements Decision statements Repetition statements (loops)
Introduction to programming in java Lecture 11 Boolean Expressions and Assignment no. 2.
LESSON 3 Working with Functions, Formulas, and Charts.
1 Introduction to the Excel ‘IF’ Function. 2 What is the ‘IF’ Function? The calculation is based on a condition that is either TRUE or FALSE. An Excel.
CIS 100 Test #3 Review REACH Computer Resource Center.
BUSINESS MATHEMATICS & STATISTICS.
Computer Science & Engineering 2111
Computer Information Technology Section 6-17
REACH Computer Resource Center
Boolean Expressions Return or display the Boolean value TRUE or FALSE
JavaScript conditional
If statement.
Making Logical Decisions (IF-THEN-ELSE)
Microsoft Excel – Part I
Conditional Logic Presentation Name Course Name
CS2011 Introduction to Programming I Selections (I)
REACH CRC Professor Manni
REACH Computer Resource Center
if(students.learn(this)) computer.willGetSmart();
Conditionals.
Presentation transcript:

Computer Science & Engineering 2111 IF and Boolean Functions 1 CSE 2111 Lecture-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]) Logical test must evaluate to true or false 2 CSE 2111 Lecture-IF and Boolean Functions

3

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

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

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

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

9

10

CSE 2111 Lecture-IF and Boolean Functions 11 Scores Statistics

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

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

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

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)

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

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

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)

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

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

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

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

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

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 Scores New Stats

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

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

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

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

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