Nested IF and Complex Condition. Nested IF Example: –Rules to determine bonus: JobCode = 1, Bonus=500 JobCode = 2, Bonus = 700 JobCode = 3, Bonus = 1000.

Slides:



Advertisements
Similar presentations
Complex Conditions. Logical Operators: AND, OR, NOT AND Cond1Cond2Cond1 AND Cond2T TF FTF OR Cond1Cond2Cond1 OR Cond2T TF FTF NOT CondNOT Cond T F.
Advertisements

CIS100 Test 2 Review REACH CRC © 2011 REACH CRC. All Rights Reserved.Spring 2011.
Work with Data and Decision Structure. Murach’s Java SE 6, C3© 2007, Mike Murach & Associates, Inc. Slide 2.
IF Function Decision: Action based on condition. Examples SF State Tuition calculation: – Fees_and_Expenses.
CS&E 1111 ExIFs IFs and Nested IFs in Excel Objectives: Using the If function in spreadsheets Nesting If functions.
Tutorial 7: Using Advanced Functions and Conditional Formatting
VB.Net Introduction - 2. Counter Example: Keep track the number of times a user clicks a button Need to declare a variable: Dim Counter As Integer Need.
IF Function Decision: Action based on condition. Examples SF State Tuition calculation: –
Complex Conditions. Logical Operators: AND, OR, NOT AND Cond1Cond2Cond1 AND Cond2T TF FTF OR Cond1Cond2Cond1 OR Cond2T TF FTF NOT CondNOT Cond T F.
Introduction to Access BUS 782. Access Objects Tables –Open –Design –New –Wizard Queries Forms Reports Pages.
Tutorial 8: Working with Advanced Functions
SUMIF() Lesson: BASIC. =SUMIF() When Do You Use It: – To add numbers based on a single criterion/condition Example: If you have a column of data with.
Theme 3: Data Dynamics Topic 18: Analyse data using Excel Chapter 3.3. Page 185 – 199 Analysing spreadsheet data.
Chapter 6 Advanced Functions Copyright 2005 Radian Publishing Co.
CIS300 TEST REVIEW EXAM 1- PROF. ZURADA & PROF. GUAN REACH - CRC © 2010 REACH All Rights Reserved.Fall 2010.
Work with Data and Decision Structure. Slide 2 Note: String and Date are classes.
Presented by: Brenda JM Sabin, CBP Key Concepts, LLC.
Excel Projects 5 & 6 Notes Mr. Ursone. Excel Project 5: Sorting a List  Sorting: Arranging records in a specific sequence  The Sort command is on the.
1. Common Functions 2.
CS&E 200 Exfunctions Using Functions in Excel Objectives: Using Excel functions l Sum, Min, Max, Average, Count l Large, Small, Rank l Round l Countif.
© Scott/Jones Publishing, Inc. 1 Chapter 18 Working with Advanced Functions Excel 2003, Volume 2 by Karen J. Jolly Scott/Jones Publishing, Inc.
Decision Structure - 1 ISYS 350. Decision: Action based on condition Examples Simple condition: – If total sales exceeds $300 then applies 5% discount;
Decision Structure - 2 ISYS 350. Complex Condition with Logical Operators The logical AND operator (&&) and the logical OR operator (||) allow you to.
1 Improvement over the old : Dcount, DSum and DAverage Functions)
Expression and Decision Structure ISYS 350. Performing Calculations Basic calculations such as arithmetic calculation can be performed by math operators.
Decision Structure - 2 ISYS 350. Complex Condition with Logical Operators The logical AND operator (&&) and the logical OR operator (||) allow you to.
Computer Science & Engineering 2111 Lecture 4 COUNTIF(s)/SUMIF(s)/SUMPRODUCT/ AVERAGEIF(s)/LARGE/SMALL/RANK 1.
Decisions Action based on condition. Examples Simple condition: –If total sales exceeds $300 then applies 5% discount; otherwise, no discount. More than.
More Spreadsheets Range Formulas & Empty Cells Logical Functions Lookup Functions.
Glade Manual – Chapter 6 1 “COUNTIF” function: - “COUNTIF” function counts the number of cells within a range that meet the given condition - In Excel:
Introduction to Access BUS 782. Creating a New Database MS Office button/New –Blank database –New database name and location.
CIS300 Test Review REACH - CRC © 2010 REACH All Rights Reserved.Fall 2010.
DECISIONS AND FUNCTIONS Module 4.2. DECISIONS AND FUNCTIONS Module 4.2.
Introduction to Access ISYS 363. Access Objects Tables –Open –Design –New –Wizard Queries Forms Reports Pages.
Homework Discussion Homework 6 (Glade Manual Chapter 6) Database functions in Excel.
CIS 300- Professor Im Test #2. MICROSOFT ® EXCEL ® LOOKUP FUNCTIONS Syntax: =VLOOKUP(lookup_value,table_array,col_index_num,[range_lookup]) Arguments:
Introduction to Access ISYS 363. Access Objects Tables –Open a table: Double click the table name –Home/View: Datasheet view Design view Queries Forms.
Decision Structure - 1 ISYS 350. Decision: Action based on condition Examples Simple condition: – If total sales exceeds $300 then applies 5% discount;
Functions BUS 782. What are functions? Functions are prewritten formulas. We use functions to perform calculations. Enclose arguments within parentheses.
FUNCTIONS The parts of a function In order to work correctly, a function must be written a specific way, which is called the syntax. The basic syntax for.
EXCEL. PARTICIPATION PROJECT STEPS a, 4b
IF Function Decision: Action based on condition. Examples SF State Tuition calculation: –
CIS 300- Professor McIntosh Test #3. MICROSOFT ® EXCEL ® MATHEMATICAL FUNCTIONS Syntax: =ROUND(number, num_digits) Arguments: number Required  The number.
CIS300 Test 3 Review Reinhardt. © 2009 Dale McIntosh. All Rights Reserved. Slides are Available at: uter/cistestreviews.html.
Decision Trees and Tables. 2 Decision Trees and Decision Tables Often our problem solutions require decisions to be made according to two or more conditions.
Decision Structure - 2 ISYS 350.
Using Advanced Functions and Conditional Formatting
Decision Structure ISYS 350.
Decision Structure - 1 ISYS 350.
CIS300 Test Review REACH - CRC Fall 2010
Decision Structure - 2 ISYS 350.
Decision Trees and Tables
Employees Working Abroad and Aliens in the U.S.
Querying Database ISYS 363.
Decision Structure - 2 ISYS 350.
Decision Structures ISYS 350.
Spreadsheet Review.
Decision Structure - 2 ISYS 350.
Decision Structure - 2 ISYS 350.
Excel Functions.
Excel Functions.
Excel: Formulas & Functions III Participation Project
Decision Structure - 1 ISYS 350.
Decision: Action based on condition
Decision Structure - 2 ISYS 350.
Functions BUS 782.
REACH CRC Professor Manni
Decision Structure - 1 ISYS 350.
REACH Computer Resource Center
Presentation transcript:

Nested IF and Complex Condition

Nested IF Example: –Rules to determine bonus: JobCode = 1, Bonus=500 JobCode = 2, Bonus = 700 JobCode = 3, Bonus = 1000 –In C2: If(B2=1, 500, If(B2=2, 700, 1000))

JobCode= 1 Or <> =1 JobCode=2 Or <>

Example Electric Company charges customers based on KiloWatt-Hour used. The rules are: –First 100 KH,20 cents per KH –Each of the next 200 KH ( up to 300 KH), 15 cents per KH –All KH over 300, 10 cents per KH

What if we have more than 3 conditions Example: Bonus –JobCode = 1, Bonus = 500 –JobCode = 2, Bonus = 600 –JobCode = 3, Bonus = 700 –JobCode = 4, Bonus = 800 –JobCode = 5, Bonus = 1000 –… Other functions: –Table lookup

Example State University calculates students tuition based on the following rules: –State residents: Total units taken <=12, tuition = 1200 Total units taken > 12, tuition = per additional unit. –Non residents: Total units taken <= 9, tuition = 3000 Total units taken > 9, tuition = per additional unit.

Resident or Not Units <= 12 or Not Units <= 9 or Not

Complex Condition University admission rules: Applicants will be admitted if meet one of the following rules: –1. Income >= 100,000 –2. GPA > 2.5 AND SAT > 900 An applicant’s Income is 150,000, GPA is 2.9 and SAT is 800. Admitted? –Income >= 100,000 OR GPA > 2.5 AND SAT >900 How to evaluate this complex condition?

Scholarship: Business students with GPA at least 3.2 and major in Accounting or CIS qualified to apply: –1. GPA >= 3.2 –2. Major in Accounting OR CIS Is a CIS student with GPA = 2.0 qualified? –GPA >= 3.2 AND Major = “Acct” OR Major = “CIS” Is this complex condition correct?

NOT Set 1: Young: Age < 30 Set 2: Rich: Income >= 100,000 YoungRich

Order of Evaluation 1. ( ) 2. Not 3. AND 4. OR

Rules to calculate employee bonus are: –If JobCode = 1 AND Salary < 5000 OR Sex = “F” Bonus = 10% * Salary –Otherwise: Bonus = 8% * Salary

Practices 1. Change the rules for bonus to: –If Sex = “F” AND (JobCode = 1 OR JobCode = 2) then bonus = 10% * Salary –Otherwise, bonus = 8% * Salary 2. Change to rules to: –If JobCode = 1 AND Salary < 5000 OR Sex = “F” Bonus = 10% * Salary –Otherwise: Bonus = 8% * Salary Use a complex condition to describe numbers:

Calculating Conditional Counts and Sums COUNTIF(range, criteria) –Range of cells –Criteria: expression that define which cells are to be counted. SUMIF(range, criteria,[sum_range]) –Sum_range: The cells you want to sum. If omit, Excel will sum the values in the range argument.

Example 1.How many employees earn more than 5000? COUNTIF(B2:b4,”>5000”) 2. Compute the total salary of employees earning more than SUMIF(B2:b4,”>5000”) 3. How many employees’ name begin with “P”? COUNTIF(A2:A4,”P*”)