Section 8 Topics Covered " The =IF() function ........................................................... 8-2 " " The =OR() function ......................................................... 8-6 The =AND() function ...................................................... 8-6 " The =NOT() function ...................................................... 8-7 " The =PMT() function ...................................................... 8-9 The =FV() function........................................................ 8-13 " Time Required: 40 Mins Microsoft Excel 2000 Introductory Course ! Student Workbook ! © 2000 ! www.StudyIT.net 8-1 The =IF() Function The =IF() function can be used to check whether a specific condition is true or not, returning one result if the condition is true, and another if it's false. The syntax of the =IF() function is =IF(condition, true value, false value) Suppose you want to pay a £50 bonus to all sales staff who have exceeded their £10,000 target. To do this you would check the total sales figures to see who qualifies. If a rep's total sales figure is greater than £10,000, the bonus would be paid. Otherwise, the rep doesn't qualify for the bonus. This example is illustrated below. Look at the formula that has been entered into cell C4. The formula is constructed as follows: Condition Result if false =IF(B4>10000, 50, 0) Result if true Microsoft Excel 2000 Introductory Course ! Student Workbook ! © 2000 ! www.StudyIT.net 8-2 The =IF() Function The results for the example shown on the previous page are illustrated below. Text Results Should you want to display text as one or both of the results, you would simply type the text (enclosed in " quotation marks) into the formula as follows: =IF(B4>10000, "Yes", "No") In this example, the word Yes would be displayed for each sales rep who qualifies for a bonus, and the word No for each sales rep who doesn't. Conditional Operators The example used above uses the > (greater than) operator. The condition within the =IF() <> (not function can incorporate any of the standard operators such as = (equal to), equal to), <= (less than or equal to), and so on. Microsoft Excel 2000 Introductory Course ! Student Workbook ! © 2000 ! www.StudyIT.net 8-3 The =IF() Function Creating An Embedded =IF() Formula When testing conditions on your worksheet, you may find that from time to time you need to check two or more related conditions. For example, once you have found that a sales rep has met his target, you may want to check by how much, awarding a higher bonus for exceeding the target by more than a set amount. To do this, you can create a formula that contains more than one =IF() function. The illustration below shows the formula required to award a £50 bonus for exceeding the target, but a £100 bonus for exceeding it by more than £5,000. 1. Check this condition... 2. ...if true, check this condition... 3. ...if first condition not true, show 0 =IF(B4>C4,IF(B4>C4+5000,100,50),0) 4. ...if second condition is true, show 100 5. ...if second condition is false, show 50 Exercise 8-1 1. Open the Bonus workbook held in the Excel 2000 Intro Exercises folder. Microsoft Excel 2000 Introductory Course ! Student Workbook ! © 2000 ! www.StudyIT.net 8-4 Exercise 8-1 2. In cell D4, enter the formula =IF(B4>=C4,"Yes","No") then copy the formula for each salesperson. This will test whether or not each person met their target. 3. Follow the instructions below to calculate how much of a bonus each sales rep is due, based on these conditions: ! If the sales rep has earned more than £12,000 in commission, a £100 bonus is payable. ! If the sales rep has earned less than £12,000 but more than £8,000 in commission, a £50 bonus is due. ! If the sales rep has earned £8,000 or less in commission, no bonus is due. — Into cell F4 enter the formula =IF(E4>12000,100,IF(E4>8000,50,0)) — Copy the formula down column F. 4. Enter a formula into column G to calculate the total amount payable to each sales rep. 5. Save the changes to the workbook and then close it. Microsoft Excel 2000 Introductory Course ! Student Workbook ! © 2000 ! www.StudyIT.net 8-5 Logical Functions Earlier you learned how to use the =IF() function. Logical functions such as =IF() are used to test whether a given condition is true or false. Other logical functions are described on the next few pages. The =OR() Function The =OR() function's syntax is =OR(logical1,logical2,...) This function will return a value of TRUE if one or more arguments (logical1, logical2, and so on) are true. Otherwise, the result will be FALSE. In the example below, the result would be TRUE, as at least one of the arguments is true. =OR(1+1=2, 2+2=5) The =AND() Function The =AND() function's syntax is =AND(logical1,logical2,...) This function will return a value of TRUE if each of the arguments (logical1, logical2, and so on) is true. Otherwise, the result will be FALSE. In the example below, the result would be FALSE, as at least one of the arguments is not true. =AND(1+1=2, 2+2=5) Microsoft Excel 2000 Introductory Course ! Student Workbook ! © 2000 ! www.StudyIT.net 8-6 Logical Functions The =NOT() Function The =NOT() function's syntax is =NOT(logical) This function will return a value of TRUE if the argument (logical) is false. Otherwise, the result will be FALSE. In the example below, the result would be TRUE: =NOT(2+2=5) Calculating Using Logical Results The results TRUE and FALSE are stored as 1 and 0 respectively. This means that you can use the results for calculations. You could, for example, calculate the total number of TRUE conditions. You cannot, however, simply add all the TRUE results: you must first multiply them by 1 to return an integer that can be used in the calculation. For instance, at step 6 in the following exercise you will calculate the number of branches that hit target. Each branch that did hit target will have a TRUE result in column D, previously calculated at step 3. Before the TRUE results can be counted, they must be multiplied by 1. Microsoft Excel 2000 Introductory Course ! Student Workbook ! © 2000 ! www.StudyIT.net 8-7 Exercise 8-2 1. Open the workbook Targets held in the Excel 2000 Intro Exercises folder. 2. Column D is to show whether each branch met its target. Therefore, enter the formula =C3>B3 into cell D3. This formula returns a value of TRUE as the North branch did hit its target. 3. Copy the formula for the other branches. 4. To answer the question Did all branches hit target? enter the formula =AND(D3:D5) into cell C7. As not every value in the range is not TRUE, the result is FALSE. 5. To answer the question Did any of the 3 branches hit target? enter the formula =OR(D3:D5) into cell C8. Because at least one of the values in the range is TRUE, the result is TRUE. 6. Follow the instructions below to calculate the number of branches that hit target. — In cell E3, enter a formula to multiply the result in cell D3 by 1 then copy the formula for the other branches. — Enter a formula that will show the total number of branches that hit target into cell C9. 7. Save the changes to the worksheet and then close it. Microsoft Excel 2000 Introductory Course ! Student Workbook ! © 2000 ! www.StudyIT.net 8-8 The =PMT() Function This function is used to calculate the payments on a loan at a specified interest rate over a given term. The syntax of the function is: =PMT(Rate,Nper,Pv,Fv,Type) Note: The arguments shown in italic are optional, i.e. they don't have to be specified. The function's arguments are explained below. Rate The interest rate for the loan. For example, if the interest rate is 10% per annum and the payments will be made annually, the value entered into the formula should be 10%. If, however, the interest rate is 10% per annum and the payments will be made monthly, the value entered into the formula should be 10%/12. Nper The number of periods over which the loan will be repaid. For example, if the loan is to be repaid over 24 months, the value entered into the formula should be 24. Pv The total value of the loan. Fv If you want to attain a cash balance at the end of the loan period, the value should be entered into the formula. Type Type can be either 0 or 1. If the payments will be made at the beginning of the specified period, enter 1. If the payments will be made at the end of the month, either enter 0 or don't enter this argument. Microsoft Excel 2000 Introductory Course ! Student Workbook ! © 2000 ! www.StudyIT.net 8-9 Exercise 8-3 1. Open the workbook LoanCalc held in the Excel 2000 Intro Exercises folder. 2. Following the instructions below, use =PMT() function to calculate the monthly repayments on a car loan of £4,000 over 2 years at an interest rate of 8.5% per annum. Rather than enter the formula directly into the cell, you'll make use of the formula palette. — Select cell B8 then click on the Edit Formula. — Select More Functions from the Function drop-down list. The Paste Function dialogue box is displayed. — From the Function category list box, choose Financial, then select PMT from the Function name list box. — Click OK. Microsoft Excel 2000 Introductory Course ! Student Workbook ! © 2000 ! www.StudyIT.net 8-10 Exercise 8-3 The formula palette expands to display the function's arguments. — The first argument is Rate. As the interest rate is held in cell B5, either type B5 into the Rate text box, or click on cell B5 on the worksheet, shrinking the dialogue box if necessary. — As the interest rate in cell B5 is an annual interest rate, and you want monthly payments, it has to be divided by 12. So, type /12 into the Rate text box so that the entry reads B5/12. — Press [TAB] to move to the Nper (number of periods) argument. — As cell B6 holds the data for this argument, either type B6 into the text box or click on cell B6, then press [TAB] to move to the Pv argument. — The amount of the loan (Pv) is held in cell B4, so either type B4 into the text box or click on cell B4. The formula palette will now look like this: Result of the formula as it currently stands — Click OK to display the result of your formula, which is -£183.66. Microsoft Excel 2000 Introductory Course ! Student Workbook ! © 2000 ! www.StudyIT.net 8-11 Exercise 8-3 3. Modify the values in cells B4 and B6 so that the loan period is 3 years and the amount is £6,000. The result of the formula changes to -£192.20. 4. Change the formula so that it calculates the monthly payments for a loan of £1,000 to be repaid over 18 months. The result of the formula becomes -£59.83. 5. Save the changes to the worksheet then close it. Microsoft Excel 2000 Introductory Course ! Student Workbook ! © 2000 ! www.StudyIT.net 8-12 The =FV() Function This function is used to calculate the redemption value of an investment assuming a series of fixed payments at a fixed interest rate. The syntax of the function is: =FV(Rate,Nper,Pmt,Pv,Type) Note: The arguments shown in italic are optional, i.e. they don't have to be specified. The function's arguments are explained below. Rate The interest rate for the investment. For example, if the annual interest rate is 11% and the payments will be made annually, the value entered into the formula should be 10%. If, however, the interest rate is 10% per annum and the payments will be made monthly, the value entered into the formula should be 10%/12. Nper The number of periods over which the investment payments will be made. For example, a pension that is to be paid monthly over 30 years would be entered as 360. Pmt The amount your will be paying into the investment fund per period, e.g. monthly/annually. Pv Is the present value, or a lump sum amount that the series of future payments is worth now. Type Type can be either 0 or 1. If the payments will be made at the beginning of the specified period, enter 1. If the payments will be made at the end of the month, either enter 0 or don't enter this argument. Microsoft Excel 2000 Introductory Course ! Student Workbook ! © 2000 ! www.StudyIT.net 8-13 Exercise 8-4 1. Open the worksheet Pension.xls held in the Excel 2000 Intro Exercises folder. 2. Using the =FV() function, calculate the redemption value of the pension fund and show in B7. 3. Change the annual contribution to 4000 to see the affect of the redemption value. 4. Save the changes and close the worksheet and close it. Microsoft Excel 2000 Introductory Course ! Student Workbook ! © 2000 ! www.StudyIT.net 8-14 Questions and Answers 1. If cell B4 contains the value 500, what is the result of the following formula? =IF(B4>100,20,0) 2. If the value in cell A10 is 1000, what is the result of the following formula? =IF(A10>10000,500,IF(A10>5000,50,0)) 3. Write the results of these formulas in the spaces provided. =OR(TRUE,TRUE,FALSE) =AND(FALSE,FALSE,FALSE) 4. In the space below write the =PMT() function required to calculate the quarterly payments for a loan of £20,000 over 3 years given an interest rate of 7%. Microsoft Excel 2000 Introductory Course ! Student Workbook ! © 2000 ! www.StudyIT.net 8-15 A2 Z Index A I And Function, 8-6 IF Function, 8-2 embedded, 8-4 C Conditional Operators, 8-3 L Logical Functions, 8-7 F Functions And, 8-6 Fv, 8-13 IF, 8-2, 8-4 logical, 8- 7 Not, 8-7 Or, 8-6 Pmt, 8-9 Fv Function, 8-13 N Not Function, 8-7 O Or Function, 8-6 P Pmt Function, 8-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Microsoft Excel 2000 Introductory Course ! Student Workbook ! © 2000 ! www.StudyIT.net 8-16