Top Banner
1 CSE 2337 Chapter 4 Logic
27

1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

Jan 02, 2016

Download

Documents

Georgia Nichols
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

1

CSE 2337Chapter 4

Logic

Page 2: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

2

Objectives

• Boolean Values• Boolean Values• Logical Operators• Conditional Logic• Nested Functions

Page 3: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

3

Boolean Logic

• Boolean Logic Values– True– False

Page 4: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

4

Background Scenario

• Dun & Bradstreet® (D&B)– Widely used financial reporting services– Provides financial information about

corporations and institutions and extensive analyses on each company’s creditworthiness and payment history (PAYDEX® index)

• Create formulas by applying several credit approval indicator rules to each customer’s data

Page 5: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

5

Page 6: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

6

Rule #1

Accept a customer who has a past due balance that is

less than 10% of this year’stotal sales

Is past due balance less than10% of this year’s total sales?

In Other Words:

Page 7: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

7

Relational Operators

• Compare to values and determine if True or False

Page 8: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

8

Rule #1 Applied

Page 9: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

9

Rule #2

Accept a customer who has eithera composite credit appraisal value

of 1 or a PAYDEX score over 90

Page 10: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

10

Rule #2

Accept a customer who has eithera composite credit appraisal value

of 1 or a PAYDEX score over 90

2 conditions that bothhave a truth value

Reduce to one Truth value

Page 11: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

11

Boolean Logic Functions

AND Used to determine if all arguments are TRUE

OR Used to determine if either argument is TRUE

NOT Evaluates only one logical argument to determine if it is FALSE

Page 12: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

12

AND

Page 13: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

13

OR

Page 14: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

14

NOT

Page 15: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

15

Logic Functions in Excel

• OR (logical1,logical2,….)• AND (logical1,logical2,…)• NOT (logical1)

Page 16: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

16

Applying Rule #2

Page 17: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

17

Rule #3

• Accept a customer who has all of the following:– Net worth of at least $500,000– Composite credit appraisal value of

2 or lower– PAYDEX score over 70– Stress risk class of 1

Page 18: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

18

Applying Rule #3

Page 19: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

19

Cell M3

Page 20: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

20

IF Conditional

• IF function– Boolean logical function that returns different

values (TRUE or FALSE) depending on how the specified condition evaluates

– =IF(logical_test,value_if_true,value_if_false)

• Nested function (permitted by IF function)– Contains additional formulas and/or functions

as one or more of its arguments

• Provides flexibility of choosing between two different sets of criteria, and up to seven different levels of logical tests

Page 21: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

21

EXAMPLE

Page 22: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

22

If to perform conditional calcuations

Page 23: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

23

Conditional Calc with IF

Page 24: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

24

Explanation

Page 25: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

25

Nested IFs

Nesting IF functions, one inside the other, allows you to ask a question, then another question depending on the outcome of the first question, and so on

Page 26: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

26

Nested IFs

Page 27: 1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.

27

Nested IF