60
Applying Logic in Decision Making Chapter 4

Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Embed Size (px)

Citation preview

Page 1: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Applying Logic in Decision Making

Chapter 4

Page 2: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Chapter Introduction

• Tools that allow comparison of data as well as analysis of sets of data using multiple criteria

• Boolean logical values (TRUE and FALSE)

• Boolean logical functions (AND, OR, and NOT)

• Specifying different cell formats based on whether a set of criteria is met

• Application of different outcomes to results of logical tests that are TRUE versus those that are FALSE

Succeeding in Business with Microsoft Excel 2010 2

Page 3: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Chapter Introduction (continued)

• Functions covered in this chapter: AND, IF, NOT, OR

To go to Level 1, click here

To go to Level 2, click here

To go to Level 3, click here

Succeeding in Business with Microsoft Excel 2010 3

Page 4: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Functions Covered in this Chapter

• AND

• IF

• NOT

• OR

Succeeding in Business with Microsoft Excel 2010 4

Page 5: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Level 1 Objectives: Analyzing Data Using Relational Operators & Boolean Logical

Functions

• Understand the Boolean logical values TRUE and FALSE

• Build formulas with relational operators

• Evaluate criteria using the Boolean logical functions AND, OR, and NOT

• Apply conditional formatting to highlight key information in a worksheet

Succeeding in Business with Microsoft Excel 2010 5

Page 6: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Reviewing Financial Criteria Related to Credit

• 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

Succeeding in Business with Microsoft Excel 2010 6 Level 1 home

Page 7: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Sample Worksheet

Succeeding in Business with Microsoft Excel 2010 7 Level 1 home

D&B data includes credit

rating class, PAYDEX

score, and stress risk

class.

Page 8: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Using Relational Operators to Compare Two Values

• To determine if the relational expression is TRUE or FALSE

• Can be used to compare

– Two values

– Text labels

– Dates

Succeeding in Business with Microsoft Excel 2010 8 Level 1 home

Page 9: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Using Relational Operators

Succeeding in Business with Microsoft Excel 2010 9 Level 1 home

Page 10: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Using Relational Operators

Succeeding in Business with Microsoft Excel 2010 10 Level 1 home

Page 11: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Using Boolean Logical Functions to Evaluate a List of Values and Determine a Single True or False Value

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

Succeeding in Business with Microsoft Excel 2010 11 Level 1 home

Page 12: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Outcomes for the AND Function Using Two Inputs

Succeeding in Business with Microsoft Excel 2010 12 Level 1 home

Page 13: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Outcomes for the OR Function Using Two Inputs

Succeeding in Business with Microsoft Excel 2010 13 Level 1 home

Page 14: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Outcomes of the NOT Function (Single Input)

Succeeding in Business with Microsoft Excel 2010 14 Level 1 home

Page 15: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Using the OR Function to Evaluate Criteria

• OR (logical1,logical2,….)

• Returns a value of TRUE if either criteria is met

• Returns a value of FALSE only if all arguments in the function are FALSE

Succeeding in Business with Microsoft Excel 2010 15 Level 1 home

Page 16: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Using the OR Function

Succeeding in Business with Microsoft Excel 2010 16 Level 1 home

Page 17: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Using the AND Function to Evaluate Criteria

• AND (logical1,logical2,…)

• Returns a value of TRUE only if all arguments in the function are TRUE

Succeeding in Business with Microsoft Excel 2010 17 Level 1 home

Page 18: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Using the AND Function

Succeeding in Business with Microsoft Excel 2010 18 Level 1 home

Page 19: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Using the AND Function

Succeeding in Business with Microsoft Excel 2010 19 Level 1 home

Page 20: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Using the NOT Function to Evaluate Criteria

• NOT (logical1)

• Takes only one argument and changes a single TRUE value to FALSE or vice versa

– NOT(TRUE) returns the value of FALSE

– NOT(FALSE) returns the value of TRUE

Succeeding in Business with Microsoft Excel 2010 20 Level 1 home

Page 21: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Using the NOT Function

Succeeding in Business with Microsoft Excel 2010 21 Level 1 home

Page 22: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Applying Conditional Formatting to a Worksheet

• Identifies a set of conditions and specifies formatting of a cell if those conditions are met

• Criteria can be specified based on:

– Value in the cell being formatted

– Results of a specified formula that returns a Boolean value

Succeeding in Business with Microsoft Excel 2010 22 Level 1 home

Page 23: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Applying Conditional Formatting Based on Cell Value

• Select cell or cell range to be formatted

• Click Conditional Formatting button arrow in Styles group on Home tab

• Select Data Bars, Color Scales, or Icon Sets from the menu to open a gallery of options

• Point to a format to preview it in the selected cells, and click the desired format to apply it

Succeeding in Business with Microsoft Excel 2010 23 Level 1 home

Page 24: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Applying Conditional Formatting Based on Cell Value

Succeeding in Business with Microsoft Excel 2010 24 Level 1 home

Page 25: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Conditional Formatting Based on Cell Value

Succeeding in Business with Microsoft Excel 2010 25 Level 1 home

Page 26: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Conditional Formatting Based on Cell Value

Succeeding in Business with Microsoft Excel 2010 26

Page 27: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Conditional Formatting Based on Cell Value

Succeeding in Business with Microsoft Excel 2010 27 Level 1 home

Page 28: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Applying Conditional Formatting Based on the Results of a Formula

• Highlight a single row as the range

• Specify two separate conditions based on two different formulas

Succeeding in Business with Microsoft Excel 2010 28 Level 1 home

Page 29: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Conditional Formatting Based on the Results of a Formula

Succeeding in Business with Microsoft Excel 2010 29 Level 1 home

Page 30: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Conditional Formatting Based on the Results of a Formula

Succeeding in Business with Microsoft Excel 2010 30 Level 1 home

Page 31: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Level 1 Summary

• Tools that allow you to evaluate and compare both text and numeric data

– Relational operators (>,<,>=, <=, =, <>)

– Boolean logical functions (AND, OR, and NOT)

• Both relational operators and Boolean functions return a Boolean logical value, TRUE or FALSE

• Using the Conditional Formatting tool

Succeeding in Business with Microsoft Excel 2010 31

Page 32: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Level 2 Objectives: Analyzing Data Using IF Functions and Nested

Functions

• Understand how to build formulas with nested functions

• Write IF functions to evaluate TRUE/FALSE values and perform calculations

• Nest functions within an IF statement

• Construct a simple nested IF function

Succeeding in Business with Microsoft Excel 2010 32

Page 33: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Introduction to IF Functions and Nested Functions

• 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

Succeeding in Business with Microsoft Excel 2010 33 Level 2 home

Page 34: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Writing an IF Function with a Logical Test That Evaluates TRUE/FALSE Values

Succeeding in Business with Microsoft Excel 2010 34 Level 2 home

Page 35: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Writing an IF Function with a Logical Test That Performs a Simple Calculation

Succeeding in Business with Microsoft Excel 2010 35 Level 2 home

Page 36: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Writing an IF Function with a Logical Test That Performs a Simple Calculation

Succeeding in Business with Microsoft Excel 2010 36 Level 2 home

Page 37: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Writing IF Functions with Nested Functions

Succeeding in Business with Microsoft Excel 2010 37 Level 2 home

Page 38: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Constructing a Simple Nested IF Function

Succeeding in Business with Microsoft Excel 2010 38 Level 2 home

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 39: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Constructing a Simple Nested IF Function

Succeeding in Business with Microsoft Excel 2010 39 Level 2 home

Page 40: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Constructing a Simple Nested IF Function

• An IF function can be used to evaluate a logical test.

• However, if the logical test results in a FALSE value, another calculation is needed.

Succeeding in Business with Microsoft Excel 2010 40 Level 2 home

Page 41: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Constructing a Simple Nested IF Function

Succeeding in Business with Microsoft Excel 2010 41 Level 2 home

Page 42: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Order of Logical Tests

• Must match established criteria for non-mutually exclusive criteria

• Can be placed in any order for mutually exclusive criteria

• Using a specific order can save considerable amount of work for criteria between a range of values

Succeeding in Business with Microsoft Excel 2010 42 Level 2 home

Page 43: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Order of Logical Tests

• Order of logical tests for non-mutually exclusive criteria

• Order of logical tests for mutually exclusive criteria

• Order of logical tests for criteria between a range of values

Succeeding in Business with Microsoft Excel 2010 43 Level 2 home

Page 44: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Level 2 Summary

• Applying Boolean logic within an IF statement

• IF function allows you to determine if an expression is TRUE or FALSE, and to return a value other than TRUE or FALSE (e.g., text or numeric values)

• Additional IF statements and other Excel functions can be nested within an IF function

Succeeding in Business with Microsoft Excel 2010 44

Page 45: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Level 3 Objectives: Creating Complex Logical Constructs for Solving

Problems

• Combine sets of criteria in an IF function

• Create a none of construct to perform a logical test

• Create an only construct to perform a logical test

• Solve more complex problems using nested IFs and Boolean logical functions

Succeeding in Business with Microsoft Excel 2010 45

Page 46: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Evaluating More Complex Criteria

• Techniques to create more complex logical constructs (combinations of multiple logical operations) to determine if none of the criteria are TRUE for a list of items, even if only certain criteria are TRUE for a list of items

• By nesting levels of IF functions, multiple sets of criteria can be sequentially analyzed until a final value is returned

Succeeding in Business with Microsoft Excel 2010 46 Level 3 home

Page 47: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Using an IF Function to Combine Sets of Criteria

• Reject

• Further Evaluate

• Accept

Succeeding in Business with Microsoft Excel 2010 47 Level 3 home

Page 48: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Using an IF Function to Combine Sets of Criteria

Succeeding in Business with Microsoft Excel 2010 48 Level 3 home

Page 49: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Using an IF Function to Combine Sets of Criteria

Succeeding in Business with Microsoft Excel 2010 49 Level 3 home

Page 50: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Using the None Of Construct

• Evaluates if none of the rules are met

• Combines two steps into one by nesting the formula

• Example: =NOT(OR(K3:K21))

Succeeding in Business with Microsoft Excel 2010 50 Level 3 home

Page 51: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Using the None Of Construct

Succeeding in Business with Microsoft Excel 2010 51 Level 3 home

Page 52: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Using the Only Construct

• Determines if only Rule #1 evaluates to TRUE, and, if so, to recommend further evaluation; OR if only Rule #2 and/or Rule #3 evaluates to TRUE and not Rule #1

• Always has a positive condition to be evaluated AND a negative condition to be evaluated – An OR function is required for either the positive

condition or the negative condition if more than one item being evaluated falls in that category

Succeeding in Business with Microsoft Excel 2010 52 Level 3 home

Page 53: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Using the Only Construct

Succeeding in Business with Microsoft Excel 2010 53 Level 3 home

Page 54: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Using the Only Construct

Succeeding in Business with Microsoft Excel 2010 54 Level 3 home

Page 55: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Nesting Boolean Logical Operators to Analyze Criteria

Succeeding in Business with Microsoft Excel 2010 55 Level 3 home

Evaluate all parts of the

Further Evaluate criteria

Page 56: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Completing the Complex Nested IF Formula

Succeeding in Business with Microsoft Excel 2010 56 Level 3 home

Page 57: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Completing the Complex Nested IF Formula

Succeeding in Business with Microsoft Excel 2010 57 Level 3 home

Page 58: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Level 3 Summary

• More complex logical constructs

– “None of” construct

– “Only” construct

• Combining constructs to solve more complex logical tasks, nesting IF functions, relational operators, and Boolean functions within the same formula

Succeeding in Business with Microsoft Excel 2010 58

Page 59: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Chapter Summary

• Relational operators (>, <, >=, <=, =, <>) and the Boolean logical functions AND, OR, and NOT allow you to evaluate and compare both text and numeric data.

• Applying Boolean logic with an IF statement – TRUE/FALSE

• Complex logical constructs – None of

– Only

Succeeding in Business with Microsoft Excel 2010 59

Page 60: Chapter 4 Applying Logic in Decision Makingcs385.cs.ua.edu/Chapter.04.pdf · Applying Logic in Decision Making Chapter 4 . ... •Apply conditional formatting to highlight key

Chapter Summary

Succeeding in Business with Microsoft Excel 2010 60