Training Guide Title

Total Page:16

File Type:pdf, Size:1020Kb

Training Guide Title

Excel 7 The IF and Nested IF Function

The IF Function The IF function will check the logical condition of a statement and return one value if true and a different value if false. The syntax of the IF function is –  =IF(logical test, value if true, value if false) =IF(B7>50,”Bonus”,”No Bonus”)  The value returned may be either a number or text  If the value to be returned is text, it must be in quotes

A logical test is any value or expression that can be evaluated to TRUE or FALSE. For example, A10=100 is a logical expression; if the value in cell A10 is equal to 100, the expression evaluates to TRUE. Otherwise, the expression evaluates to FALSE. This argument can use any comparison calculation operator.

In general, logical tests take on the following forms:

 a=b ( equal to )  a>b ( greater than )  a=b ( greater than or equal to )  a<=b ( less than or equal to )  a<>b ( a is not equal to b)

All IF functions have three parts:

1. The test –Where you ask Excel to make a decision that must be TRUE or FALSE 2. The result if the test is TRUE 3. The result if the test is FALSE

ITS-Training Page 1 Filename:0b714682912d9002f5967bf8cc26626b.doc Help Desk 756-7000 Revised: 1/8/2018 In the example above, Excel is being asked to check cell B7 to see if it is greater than 50. If it is greater than 50, then insert the word "Bonus", otherwise, insert the words "No bonus".

Working with the IF function

Create this workbook

Create the If Function Practice worksheet 1) Start Excel 2) Open the IF function.xls workbook 3) Rename the first worksheet to Practice Worksheet a) Double click on the worksheet tab (Sheet 1) b) Type Practice Worksheet 4) In Cell A1 enter If Function Practice 5) Merge and center this text spanning cells A1 to E1 a) Select cells A1 to E1 by clicking on cell A1 and while holding down your mouse drag across to cell E1 b) Click on the Merge and Center icon in the toolbar

i) 6) Enter Day of the week in cell A3 7) Enter Peaches in cell B3 8) Enter If Statement 1 in cell B4 9) Enter If Statement 2 in cell B5 10) Enter If Statement 3 in cell B6

ITS-Training Page 2 Filename:0b714682912d9002f5967bf8cc26626b.doc Help Desk 756-7000 Revised: 1/8/2018 Bold Row 1 and Row 3 a) Click on the number 1 in the row list, hold down the Ctrl key then click on the number 3 in the row list, and then select bold from the tool bar.

Bold

Row 1 and 3 11) Resize column A,B and C a) Double click on the dividing line between each column header i) Put your cursor between column A and B. When you get the two headed arrow do a double click. This will auto size the column to fit the cell with the most data in it. Or you can select the entire worksheet then go to Format on the toolbar down to Column then select AutoFit

12) In cell A4 enter Monday 13) Using the pull handle of cell A4 pull down to auto fill cell A5 to A10 a) Monday through Sunday

Pull Handle

14) Under the heading Peaches enter the following information a) B4 10, B5 25, B6 45, B7 35, B8 13, B9 28 and B10 35

ITS-Training Page 3 Filename:0b714682912d9002f5967bf8cc26626b.doc Help Desk 756-7000 Revised: 1/8/2018 Working with IF statements

1) The first logical test to perform will be – a) If the number of peaches sold on any day is greater than 25 then insert the word Bonus (TRUE), if the number of peaches sold on any day is not greater than 25 (False) then insert the words No Bonus. i) The formula is (1) =IF(C4>25,”Bonus”,”No Bonus”) (2) The formula can be typed in the formula bar or the formula palette can be used. b) To use the formula pallette i) Click in cell C4 (Make cell C4 active) ii) Click on the Insert Function button in the formula bar

(1) (2) The Insert Function wizard will pop up

(3) Scroll down under Select a function: until you get to IF or click on ABS and type in the letter I. (4) Double click on the function IF. This will bring up the Function Arguments screen

ITS-Training Page 4 Filename:0b714682912d9002f5967bf8cc26626b.doc Help Desk 756-7000 Revised: 1/8/2018 (5) In the Logical_test box enter B4>25 (6) Tab to the Value_if_true box and type in Bonus (7) Tab to the Value_if_false box and type in No Bonus (8) Click on OK

(9) Then copy this formula down column C

Practice 1) Under If Statement 2 build the following IF statement a) If the number of peaches is greater than or equal to 25 then insert Bonus if this is not true then insert No Bonus 2) Under If Statement 3 build the following IF statement a) If the number of peaches is greater than or equal to 25 then insert $25.00 if this is not true then insert No Bonus Your spreadsheet should look like this when you are done-

ITS-Training Page 5 Filename:0b714682912d9002f5967bf8cc26626b.doc Help Desk 756-7000 Revised: 1/8/2018 The Nested IF Statement

A nested IF statement is used to perform a logical test which can result in multiple results. Only 7 arguments are allowed in a nested IF statement. Practice 1) Select the worksheet Which is larger

2) In cell D4 create the formula that will perform the following calculation-In cell D4 evaluate the item in cell B4 against the data in cell C4 and in cell D4 put A or B depending on which value is larger. ( You might want to read that again.) a) Using the Paste Function button create the following formula i) =IF(B4>C4,"A","B") ii) Using the pull handle copy this formula on down to cell D13 iii) Note the results in cells D6 and D8 are not correct as both values are equal 3) Create a nested IF formula that will evaluate not only which value is largest but also which value is equal. a) In cell E4 create the following formula by typing the formula in the formula bar i) =IF(B4>C4,"A",IF(C4>B4,"B","Equal")) ii) Copy this formula down to cell E13 iii) This formula is evaluating the information in cell B4 to see if it is larger than the information in cell C4. If this evaluates to TRUE then the formula will put A in cell D4. If B4 is not larger than C4 then it will evaluate as FALSE and then go to the next test which will then evaluate if C4 is greater than B4. If that statement is TRUE the formula will put B in cell D4. If this statement is FALSE then Equal will be put in cell D4.

ITS-Training Page 6 Filename:0b714682912d9002f5967bf8cc26626b.doc Help Desk 756-7000 Revised: 1/8/2018 Using a Nested IF statement to calculate letter grades

1) In the IF Function Workbook go to the Medieval English worksheet

2) Practice totaling the columns and doing the Average, Minimum and Maximum functions in the appropriate rows. Make sure to do the Quiz Averages in column J. 3) Based on the Quiz Averages use an IF statement to determine if a student passes or fails. A passing grade is 60 – 100. a) In cell K6 enter this formula i) =IF(J6>59,"Pass","Fail") ii) Copy the formula on down 4) The following grading criteria will be used to determine a students grade a) 100 – 90 = A b) 89 – 80 = B c) 79 – 70 = C d) 69 – 60 = D e) 59 or less = F 5) In cell K6 build a nested IF statement that will evaluate the Quiz Average into a letter grade. a) The formula to do this will be i) =IF(J6>89,"A",IF(J6>79,"B",IF(J6>69,"C",IF(K6>59,"D","F")))) ii) This formula says, If the value in cell J6 is greater than 89 then A, if J6 is not greater than 89 (FALSE) then go to the next criteria. Is J6 greater than 79? If this is TRUE then evaluate to B. If this is false then go to the next criteria. Is J6 greater than 69? If this is TRUE then evaluate to C. If this is FALSE then go to the next criteria. Is J6 greater than 59? If this is TRUE then evaluate to D. If all of this is still FALSE then evaluate to F. ( Ouch?!? My head hurts.)

ITS-Training Page 7 Filename:0b714682912d9002f5967bf8cc26626b.doc Help Desk 756-7000 Revised: 1/8/2018 iii) Syntax is very important. Make sure that any text is in quotes and make sure that there are as many parentheses at the end of the formula as there is in the formula itself. You also need to make sure that you have commas in the correct place.

Practice Go to the Budget worksheet and follow the directions at the top of the page. Go to the Sales worksheet and follow the directions at the top of the page.

ITS-Training Page 8 Filename:0b714682912d9002f5967bf8cc26626b.doc Help Desk 756-7000 Revised: 1/8/2018

Recommended publications