CS&E 1111 ExIFs IFs and Nested IFs in Excel Objectives: Using the If function in spreadsheets Nesting If 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.
EXCEL 2007 Cell Referencing IF Function. CELL REFERENCING Three Types: –Relative –Absolute –Mixed.
The IF Function Learning Outcome formulate and use the IF and nested IF statements formulate and use the IF and nested IF statements.
The IF function Bernard Liengme. Objectives To know how to: Construct a condition using the comparison operators =, >=, >, ; Construct a formula using.
The If Then Else Statement Using JavaScript TIP The If Statement is the fundamental control structure that allows branches in the flow of control in a.
CIS100 Test 2 Review REACH CRC © 2011 REACH CRC. All Rights Reserved.Spring 2011.
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.
MONTEGO BAY HIGH SCHOOL INFORMATION TECHNOLOGY THE EXCEL IF FUNCTION.
情報基礎 B Lecture 5 Takeshi Tokuyama Tohoku University Graduate School of Information Sciences System Information Sciences Design and Analysis of Information.
Computer Science & Engineering 2111 IF and Boolean Functions 1 CSE 2111 Lecture-IF and Boolean Functions.
1 Conditional Statement. 2 Conditional Statements Allow different sets of instructions to be executed depending on truth or falsity of a logical condition.
Selection (decision) control structure Learning objective
1 CSC103: Introduction to Computer and Programming Lecture No 8.
2-1 Making Decisions Sample assignment statements PayAmount = Hours * Rate PayAmount = 40*Rate + (Hours – 40)*Rate*1.5.
1 Conditionals In many cases we want our program to make a decision about whether a piece of code should be executed or not, based on the truth of a condition.
Chapter 4: Control Structures: Selection
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.
Chapter 4 MATLAB Programming Logical Structures Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Programming with MATLAB. Relational Operators The arithmetic operators has precedence over relational operators.
IS 1181 IS 118 Introduction to Development Tools VB Chapter 03.
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.
Computer Science 1000 Spreadsheets II Permission to redistribute these slides is strictly prohibited without permission.
1 Spreadsheets SELECTION. 2 Aims  Understand the principles of selection in Excel  Examine the basic IF statement format  Look into Nested IF statements.
REACH-CRC © 2013 REACH-CRC. All Rights Reserved.Spring 2013.
1. Common Functions 2.
1 CSE 2337 Chapter 4 Logic. 2 Objectives Boolean Values Logical Operators Conditional Logic Nested Functions.
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.
Unit 4, Lesson 4 Using Function Formulas. Objectives Understand function formulas. Understand function formulas. Use the Average and Sum functions. Use.
Conditions in Java. First…Boolean Operators A boolean data type is always true or false. Boolean operators always return true or false For example: (x.
Flow of Control Unless indicated otherwise, the order of statement execution through a method is linear: one after the other in the order they are written.
Problem Solving with Decisions
CIS300 Test Review REACH - CRC © 2010 REACH All Rights Reserved.Fall 2010.
IT CS 200: C ONDITION Lect. Napat Amphaiphan. T HE ABILITY TO CONTROL THE FLOW OF YOUR PROGRAM, LETTING IT MAKE DECISIONS ON WHAT CODE TO EXECUTE 2.
Chapter 2 Excel Fundamentals Logical IF (Decision) Statements Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Pascal Programming George Boole, a 19 th Century mathematician, is created with true, false logic. A Boolean expression in Pascal will be true or false.
CIS 100 Test #2 Review 1. EXCEL Functions on Test  SUM, COUNT, COUNTA, MAX, MIN, MEDIAN, MODE, AVERAGE, ROUND, and IF  Possibly Others 
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
Chapter 7 Conditional Statements. 7.1 Conditional Expressions Condition – any expression that evaluates to true/false value Relational operators are BINARY.
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.
Decision making If.. else statement.
Excel IF Function.
Conditional or Decision Logic
Boolean Expressions Return or display the Boolean value TRUE or FALSE
Upsorn Praphamontripong CS 1110 Introduction to Programming Fall 2016
Chapter 4 MATLAB Programming
CIS300 Test Review REACH - CRC Fall 2010
Operator Precedence Operators Precedence Parentheses () unary
Boolean Expressions and If
JavaScript conditional
Control Structures.
If Statement Functions in Excel
ICS 3U Tuesday, September 21st.
Decision making If statement.
Microsoft Excel – Part I
Visual Basic – Decision Statements
CS 1111 Introduction to Programming Spring 2019
Conditional Logic Presentation Name Course Name
JavaScript conditional
CS2011 Introduction to Programming I Selections (I)
REACH CRC Professor Manni
Chapter 4: Boolean Expressions, Making Decisions, and Disk Input and Output Prof. Salim Arfaoui.
REACH Computer Resource Center
Decision Structures if, if/else conditions
Flow of Control Flow of control is the order in which a program performs actions. Up to this point, the order has been sequential. A branching statement.
Presentation transcript:

CS&E 1111 ExIFs IFs and Nested IFs in Excel Objectives: Using the If function in spreadsheets Nesting If functions

CS&E 1111 ExIFs The IF function l The IF function is a logical function used for making decisions based on some condition(s) l Conditions have to result in Boolean values. (relational expressions, true/false) l Lends more flexibility since the results can be something else besides a simple True - False value If your total points are less than 600 then display “Fail” in the cell otherwise display “Pass”

CS&E 1111 ExIFs The IF function syntax = IF(logical_test, value_if_true,value_if_false) The IF function has 3 arguments - the first two are required l First argument : is any value or expression that can be evaluated to TRUE or FALSE. l Second argument: the value that is returned if logical_test is TRUE (then) l Third argument: the value that is returned if logical_test is False (else) – this argument is optional Sometimes you may see the statement described as If (, if true then, else )

CS&E 1111 ExIFs A simple IF formula l Write a formula in cell G4 to list whether this is an honor student as indicated by the letter H or a non- honor student as indicated with the letter R. =IF(F4, “H”, “R”) or IF(F4=FALSE, “R”, “H”) l What would result if the “” marks around the letter H were omitted?.. Try it and see.

CS&E 1111 ExIFs Examples – IF’s with relational expressions as conditions l Write a formula in cell F4 to determine if Blue passed or failed (a minimum of 300 points is required to pass) =IF(E4>=300, “pass”, “fail”) or IF(E4<300, “fail”, “pass”) l Write a formula in cell G4 to determine Blue’s curved grade. If the grade is below 150 add 10%, if the grade is 150 or above the grade remains the same =IF(E4<150, E4*1.1, E4)

CS&E 1111 ExIFs l Write a formula in cell F4 to determine if Blue got an A - to get an A Blue needs to have the highest score on all 3 exams =IF(And(B4=B8,C4=C8,D4=D8), “A”) l Write a formula in cell F4 to determine if Blue got a B. To get a B Blue needs to have a total score higher than the class average - otherwise he gets a C =IF(E4>Average(E4:E6), “B”, “C”) IF’s with Boolean and Arithmetic functions in the condition

CS&E 1111 ExIFs If Blue has at least 350 points he will get an A, else if he has less than 350 points but at least 300 points he will get a B, otherwise he gets a “C” How can you write a formula that requires a series of conditions to be evaluated each dependent upon the results of the previous condition?

CS&E 1111 ExIFs Before designing a nested-if formula – Use a logic diagram (Decision Tree) to understand the logic. Does Blue have at least 350 points? True False Blue gets an A Does Blue have at least 300 points? True False Blue gets a B Blue gets a C 1 st If statemen t 2 nd If statemen t

CS&E 1111 ExIFs NESTED IF The second argument and/or third argument of an IF statement can be another IF statement - up to 64 levels of nesting! Here is an example with 2 levels of nesting – so three outcomes are possible. IF (Blue has at least 350 points, then he gets an A, else IF ( Blue has at least 300 points, then he gets a B, else he gets a C ) )

CS&E 1111 ExIFs Nested IF Example =If(E4>=350, “A”, IF(E4>=300, “B”, “C”)) Write a formula in cell F4: If Blue has at least 350 points he gets an “A”, if he has less than 350 points but at least 300 points he gets a “B”, otherwise he gets a “C” 1 st logical testValue-if-TrueValue-if-False is a nested If

CS&E 1111 ExIFs Now apply letter grades based on this grading scheme =If(E4>=grades!B$2, grades!A$2, If(E4>=grades!B$3, grades!A$3, If(E4>=grades!B$4, grades!A$4, If(E4>=grades!B$5, grades!A$5, grades!A$6)))) grades!

CS&E 1111 ExIFs Order matters with criteria that are not mutually exclusive =If(E4>340, “X”, IF(D4>=160, “Y”, “none”)) Blue gets scholarship A if he received more than 340 points, if he didn’t get scholarship X but has at least 160 points on the final he’d get scholarship Y – otherwise no scholarship. 1 st logical testValue-if-TrueValue-if-False is a nested If

CS&E 1111 ExIFs What to remember about using IF’s l An IF function allows you to make a decision based on a criteria. The first argument contains the logical_test, the 2 nd the value-if-true and the 3 rd (optional) the value-if-false. l For any IF statement, either the second argument (TRUE) or third argument (FALSE) is applied, not both. l Consider if the criteria are not mutually exclusive this will affect the order of the arguments. l In a Nested IF statement, each IF must be complete with all required arguments specified and a corresponding set of ( ).