Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
TIME VALUE OF MONEY Analogy to Calculator Financial Keys All financial calculators have five financial keys, and Excel's basic time value functions are exactly analogous. The table below shows the equivalency between the calculator keys and Excel functions: Calculator Key Excel Function Solve for Number of Periods N NPer(rate, pmt, pv, fv, type) Solve for periodic interest rate I/Yr Rate(nper,pmt,pv,fv,type,guess) Purpose Solve for PV present value PV(rate,nper,pmt,fv,type) Solve for annuity payment PMT PMT(rate,nper,pv,fv,type) Solve for future value FV FV(rate,nper,pmt,pv,type) 1 FUTURE VALUE OF LUMP SUMS – FV( ) Suppose that you received money for a birthday/graduation/special event, and now have $1,000 to invest for a period of 5 years. How much will you have accumulated at the end of this time period if your money earns 5% interest? Where can you invest this money, and what is the interest rate you’ll receive for your investment? For CD rates, savings/checking bank rates, go to: www.bankrate.com To find the future value of this lump sum investment, use the FV function, which is defined as: FV(rate,nper,pmt,pv,type) In this problem: Rate is 5%, NPer (total number of payment periods) is 5 years (compounded annually), the $1,000 is the present value (PV). Open a new workbook and enter the data as shown below, but leave B5 blank for now. Select cell B5 and then type: =FV(B3,B2,0,-B1) and then press Enter. Every ‘time value of money’ problem has either 4 or 5 variables (corresponding to the 5 basic financial variables). In this case, we have a 4-variable problem and were given 3 of them (Nper, Rate, and PV) and had to solve for the 4th (FV). Be sure that any variables not in the problem are set to 0, otherwise they will be included in the calculation. In this case, we did not have an annuity payment (PMT), so the third argument in the FV function was set to 0. 2 Note that we left out the optional Type argument. The Type argument tells Excel when the first cash flow occurs (0 if at the end of the period, 1 if at the beginning). When solving lump sum problems such as this, the argument has no effect. Note that, unlike most financial calculators, there is no argument to set the compounding frequency. In Excel functions, you must set NPer to be the total number of periods, Rate to be the interest rate per period, and PMT to be the annuity payment per period. So, if this problem had said that the compounding was monthly (annual was implied), then we would have typed =FV(B3/12,B2*12,0,-B1). The annual percentage yield (APY), is compounded monthly, would be 5.116% Notice that we entered -B1 (-1,000) for the PV argument in the function. Cash inflows are entered as positive numbers and cash outflows are entered as negative numbers. In this problem, the $1,000 was an investment (i.e., a cash outflow). Had you entered the $1,000 as a positive number no harm would have been done, but the answer would have been returned as a negative number. It is important that you always use cell references in your formulas. Never type a number directly into any formulas or Excel functions (unless that number will never change). REAL RATE OF RETURN FORMULA A REAL RATE OF RETURN is a return on an investment that is adjusted for inflation, taxes or other external factors. An example of the real rate of return formula would be an individual who wants to determine how much goods they can buy at the end of one year after leaving their money in a money market account that earns interest. A Money Market Account (MMA) is a type of savings account that usually earns a higher amount of interest than a basic savings account. The minimum deposit and balance for this account is often considerably higher than the minimum balance of a basic savings account. For this example of the real rate of return formula, we must assume that the individual wants to purchase the exact same goods and same proportion of goods that the consumer price index uses considering that it is used often to measure inflation. 3 SCENARIO: The money market yield is 5%, inflation is 3%, and the starting balance is $1,000. Using the real rate of return formula, this example would show a real rate of 1.942%. With a $1000 starting balance, the individual could purchase $1,019.42 of goods based on today's cost. In Excel: r = (1+R) / (1+h) – 1 r = real rate of return R = nominal rate h = inflation WHY IT MATTERS: It is critical to consider the real rate of return on an investment before investing. Inflation, which is often 2% or 3% per year, reduces the value of money as time passes, and taxes certainly take a chunk away too. What's left -- the real rate of return -- often can be unimpressive after considering these adjustments. Accordingly, investors must consider whether the risk associated with the investment is appropriate given the real rate of return. SOLVING FOR THE NUMBER OF PERIODS – NPER( ) Sometimes you know how much money you have now, and how much you need to have at an undetermined future time period. If you know the interest rate, then you can solve for the amount of time that it will take for the present value to grow to the future value by solving for N. SCENARIO: Suppose that you have $1,250 today and you would like to know how long it will take you double your money to $2,500. Assume that you can earn 9% per year on your investment. You can easily find the exact answer using the NPer function. This function is designed to solve for the number of periods and is defined as: NPer(rate, pmt, pv, fv, type) 4 Create a new worksheet and enter the data shown below: Select B5 and type: =NPER(B3,0,-B1,B2) You can see that it will take 8.04 years to double your money. One important thing to note is that you absolutely must enter your according to the cash flow sign convention. If you don't make either the PV or FV a negative number (and the other one positive), then you will get a #NUM error instead of the answer. That is because, if both numbers are positive, Excel thinks that you are getting a benefit without making any investment. If you get this error, just fix the problem by changing the sign of either PV or FV. In this problem it doesn't really matter which one is negative. The key is that they must have opposite signs. Solving for N answers the question, "How long will it take..." Let's look at an example: Imagine that you have just retired, and that you have a nest egg of $1,000,000. This is the amount that you will be drawing down for the rest of your life. If you expect to earn 6% per year on average and withdraw $70,000 per year, how long will it take to burn through your nest egg (in other words, for how long can you afford to live)? Assume that your first withdrawal will occur one year from today. In this problem, we know the present value ($1,000,000), the annual payment ($70,000), and the interest rate (6%). We want to know how long the money that you have now will last. In other words, we want to solve for the number of periods. Set up a worksheet to look like the one below: Select B5 and enter: =NPER(B3,B2,-B1) You will see that you can make 33.40 withdrawals. Assuming that you can live for about a year on the last withdrawal, then you can afford to live for about another 34.40 years. 5 Now, let's change the problem slightly: Suppose that you would like to leave an inheritance of at least $100,000 to your favorite charity. How does this affect the number of periods in which you can withdraw the $70,000 per year? It should be obvious that the answer will be less than before because you aren't going to withdraw the entire $1,000,000. However, be aware that this is not the same as investing only $900,000 today because the $100,000 is a future value. Modify your worksheet so that it looks like the one below: The formula in B6 needs to be changed to: =NPER(B4,B3,-B1,B2). Note that the future value argument (B2) should be entered as a positive number. In this case, saving $100,000 to give as an inheritance will reduce the amount of time that you can draw on your savings to 31.86 years. SOLVING FOR THE INTEREST RATE – RATE( ) Maybe you have recently sold an investment and would like to know what your compound average annual rate of return was. Or, perhaps you are thinking of making an investment and you would like to know what rate of return you need to earn to reach a certain future value. SCENARIO: Suppose that you are planning to send your child to college in 18 years. Furthermore, assume that you have determined that you will need $100,000 at that time in order to pay for tuition, room and board, etc. If you have $20,000 to invest today, what compound average annual rate of return do you need to earn in order to reach your goal? Finding the interest rate in a time value of money problem requires the use of the Rate function, which is defined as: Rate(nper,pmt,pv,fv,type,guess) (Note that the Guess argument is rarely required and is optional.) 6 Create a new worksheet and enter the data as shown below. Select B5 and enter the Rate function: =RATE(B3,0,-B1,B2). As before, you need to be careful when entering the PV and FV into the function. In this case, you are going to invest $20,000 today (a cash outflow) and receive $100,000 in 18 years (a cash inflow). Therefore, enter -20,000 for PV, and 100,000 into FV. When you have solved a problem, always be sure to give the answer a second look and be sure that it seems likely to be correct. This requires that you understand the calculations that the functions are doing and the relationships between the variables. If you don't, you will quickly learn that if you enter wrong numbers you will get wrong answers. Remember, Excel only knows what you tell it, it doesn't know what you really meant. SOLVING FOR THE PAYMENT AMOUNT – PMT( ) We often need to solve for annuity payments. For example, you might want to know how much a mortgage or auto loan payment will be. Or, maybe you want to know how much you will need to save each year in order to reach a particular goal (saving for college or retirement perhaps). SCENARIO: Suppose that you are planning to send your child to college in 18 years. Furthermore, assume that you have determined that you will need $100,000 at that time in order to pay for tuition, room and board, etc. If you believe that you can earn an average annual rate of return of 8% per year, how much money would you need to invest at the end of each year to achieve your goal? Open a new worksheet and enter the data as shown below: In this problem you want to solve for an annual annuity payment, so you will use the PMT function. Select B5 and enter: =PMT(B3,B2,0,B1). 7 (Note that you entered 0 for the PV argument because the problem doesn't specify an initial investment.) You will find that you need to invest $2,670.21 per year for the next 18 years to meet your goal of having $100,000. Now, let's change the problem slightly by including a lump sum investment made today: Suppose that you have just received a gift from one of your children’s grandparents. They have given you $5,000 to be invested to help pay for her college tuition. How does this change the amount that you would have to invest each year? Since you will now be investing $5,000 today (the PV), the amount that you need to save in future years will be reduced. To find out the new annual payment that is required, you need to modify the spreadsheet somewhat. First, select Row 1 and insert a new row. Now, in A1 type: Present Value and in B1 enter: 5,000. Finally, you need to change the formula in B6 to: =PMT(B4,B3,-B1,B2). Notice that the PV argument has been changed from 0 to -B1. It has to be entered as a negative number because the $5,000 will be invested (a cash outflow). If you had put it in as a positive number, then you would get the wrong answer ($3,203.72). You should catch this error because the result is higher than if you didn't have the $5,000 to invest. Again, you always have to think about the direction of the cash flows when using these functions. 8 PRESENT VALUE – PV( ) YOU'VE WON THE LOTTERY! NOW WHAT? Friday the 13th was your lucky day. You won the lottery! The lottery officials have given you a choice. You can either receive the $10 million now in one lump sum, or you can receive $1 million a year for the next 20 years. Now what do you do? (The present value of $10 million right now is $10 million.) =PV(0.1,20,-10000000) Change the interest rate to 5% and make the same calculations again. The higher interest rate the less the future sum is worth now. The interest rate represents the opportunity cost of current consumption versus consumption at a later date. If the interest rate, which could be earned on the income now, is higher (10% v. 8%) than your potential future income will be higher because your investment will earn a higher return. Thus at some interest rate of return there will be a decision to make between taking the lump sum now or receiving payments. 9 CALCULATING PAYMENTS – PMT( ) SCENARIO: Imagine that you are about to take out a 30-year fixed-rate mortgage. The terms of the loan specify an initial principal balance (the amount borrowed) of $200,000 and an APR of 6.75%. Payments will be made monthly. What will be the monthly payment? How much of the first payment will be interest, and how much will be principal? Your first priority is to calculate the monthly payment amount. You can do this most easily by using Excel's PMT function. Note that since we are making monthly payments, we will need to adjust the number of periods (NPer) and the interest rate (Rate) to monthly values. Open a new spreadsheet and enter the data as shown below: You can see that the monthly payment is $1,297.20. (Note that your actual mortgage payment would be higher because it would likely include insurance and property tax payments that would be funneled into an escrow account by the mortgage service company.) That answers your first question. So, you now need to separate that payment into its interest and principal components. You can do this using a couple of simple formulas (you will use some built-in functions in a moment): Monthly Interest Payment = Principal Balance x Monthly Interest Rate Monthly Principal Payment = Monthly Payment - Monthly Interest Payment Using these formulas, you can see that the interest component of the first payment would be: Interest in 1st Payment = 200,000 x 0.005625 = $1,125 and the principal payment is: Principal in 1st Payment = 1,297.20 - 1,125 = $172.20 Note that the sum of the interest and principal is the amount of the total payment: 1,125 + 172.20 = $1,297.20 That is the case for every single payment over the life of the loan. However, as payments are made the principal balance will decline. This, in turn, means that the interest payment will be lower, and the principal payment will be higher (because the total payment amount is constant), for each successive payment. 10 MACROS An Excel macro is a set of programming instructions stored in what is known as VBA (Visual Basic for Applications) code that can used to eliminate the need to repeat the steps of commonly performed tasks over and over again. ADDING THE DEVELOPER TAB By default in Excel, the Developer tab is not present on the Ribbon. To add it: 1. Click the File tab to open the drop down list of options 2. On the drop down list, click Options to open the Excel Options dialog box 3. In the left hand panel of the dialog box, click on Customize Ribbon to open the Customize Ribbon window 4. Under the Main Tabs section in the right-hand window, click on the check box next to Developer to add this tab to the Ribbon 5. Click OK to close the dialog box and return to the worksheet. The Developer should now be present - usually on the right-hand side of the Ribbon RECORD A MACRO 1. On the Developer tab, in the Code group, click Record Macro. Optionally, you can assign your macro a shortcut key combination so that it's easy to run. 2. Click OK to start the Macro Recorder. 3. In your workbook, perform the actions that you want recorded, which can include typing words or numbers, clicking cells, clicking buttons, dragging cells, formatting, and more. 4. When you're done with the actions that you want recorded, click Stop Recording. RUN A MACRO 1. On the Developer tab, in the Code group, click Macros. 2. In the Macros dialog box, find your macro and click Run. Note If you assigned your macro a keyboard combination (for example, CTRL+SHIFT+M) when you started the macro recorder, you can use that shortcut to run the macro. ADD A MACRO TO THE QUICK ACCESS TOOLBAR 1. 2. 3. 4. 5. 6. Click the File tab, and then click Options. Click Quick Access Toolbar. Under Choose Commands from, select Macros. Find and select your macro in the list. Click Add and then click OK. To change the name of the macro that's shown on the Quick Access Toolbar, click Modify and type the name you want displayed in the Display name box. 11 ADD A MACRO TO A SHAPE AS A HYPERLINK 1. 2. 3. 4. Click Insert, Shapes and choose a shape (I’m using rounded rectangle). Use the mouse to draw a button on the worksheet. Double-click inside the button and type some text (ie. ‘Click to Copy Rows’). Right-click on the shape, click Assign Macro, select the name of your VB/macro and click OK. 5. Click off the button to deselect it. 6. Now you’re ready to try the macro. Click the button and the macro will run. 7. Save the workbook – the VB code will be saved with it. BUT….you must save the workbook as a macro-enabled workbook. 12 VISUAL BASIC FOR APPLICATIONS (VBA) On your keyboard press the ALT+F11 keys .You now see the Visual Basic Editor. Again, press ALT/F11 and you are back into Excel. Use the ALT/F11 key to go from Excel to the VBA and back. Go to the menu bar VIEW and click PROJECT EXPLORER. Go back to the menu bar VIEW and click PROPERTIES WINDOW. To display the CODE WINDOW click on Sheet1 in the PROJECT EXPLORER pane. A new Excel workbook includes three sheets and another component named ThisWorkbook. This component is the location where you will store the macros (also called VBA procedures) for your workbook. The three sheets and ThisWorkbook start automatically when the workbook is opened. The PROPERTIES WINDOW shows you the properties of the component that is selected in the PROJECT WINDOW. For example, if you single click on Sheet1 in the PROJECT WINDOW you see the properties of Sheet1 in the PROPERTIES WINDOW. Return to your spreadsheet and change the name on the tab of Sheet1 to Introduction. Notice in the PROPERTIES WINDOW that the property NAME has changed to Introduction. 13 The CODE WINDOW is where 90% of the VBA work is done; writing VBA sentences, testing your VBA procedures and modifying them when needed. To illustrate what you can do in the CODE WINDOW, start by creating a small macro in an empty workbook. Switch to the VBE. Double-click on Sheet 1 in the PROJECT WINDOW. On the right is the CODE WINDOW for Sheet 1. Click anywhere in the CODE WINDOW and type the text below: Sub myFirst() Range(“A1”).Value = 34 Range(“A2”).Value = 66 Range(“A3”).Formula = “=A1+A2” Range(“A1”).Select End Sub Click on any line of the macro, go to the menu bar at the top of the VBE screen and click Run; then click Run Sub/Userform. Go back to Excel (ALT/F11) and see what has happened to cells A1, A2 and A3. Go back to Excel and clear the cells A1, A2 and A3 of Sheet1. On the menu bar go to Tool and click on Macros. In the dialog window select myFirst and click Run. In the VBE, retype sub myFirst() without using a capital S as the beginning of sub. After entering the closing parenthesis click Enter. The VBE capitalizes letters appropriately when the word is spelled correctly. o This is one interesting feature that you should always use when writing macros. Make it tour habit never to use capital letters when writing code. In this way, whenever VBE fails to capitalize a letter, you will know that something is wrong. Function SumCode(rng As Range) sumx = 0 For Each cell In rng sumx = sumx + cell.Value Next SumCode = sumx End Function 14 1. Open a spreadsheet in Excel. 2. Copy the following macro code: Sub Test() Dim Destrange As Range Dim Smallrng As Range Dim Newsh As Worksheet Dim Ash As Worksheet Dim Lc As Long Application.ScreenUpdating = False Set Ash = ActiveSheet Set Newsh = Worksheets.Add Ash.Select Lc = 1 For Each Smallrng In Selection.Areas Smallrng.Copy Set Destrange = Newsh.Cells(1, Lc) Destrange.PasteSpecial xlPasteValues Destrange.PasteSpecial xlPasteFormats Lc = Lc + 1 Next Smallrng Newsh.Columns.AutoFit Newsh.PrintOut Application.DisplayAlerts = False Newsh.Delete Application.DisplayAlerts = True Application.ScreenUpdating = True End Sub 3. From the Excel Developer tab, click Visual Basic: 15 4. In the Visual Basic screen, click Insert, Module and then paste the code in the window: 5. You can close this Visual Basic window. When prompted to Save, make sure you now save your spreadsheet as a macro-enabled spreadsheet (i.e. My_Spreadsheet.xlsm). The macro-enabled spreadsheet option is available in the Save As dropdown: 16 6. To use the macro, select an area in your spreadsheet that you’d like to print. From the Developer tab, click Macro, Test, Run (if you’d like a different name, change the code on the 1st page of this document before you paste it into the Visual Basic window). 7. This is how your report will print: 8. If you don’t want to click Macro and run Test, you can change the macro to run from a keyboard shortcut or add as a button to the Quick Access Toolbar. Choose Modify instead of Run when you click Macro from the Developer tab. 17 If your Excel workbook contains multiple worksheets and you’d like to combine all the sheets onto just one sheet, follow the steps below: 1. Open the Excel workbook and add a new sheet. Make sure to place this new sheet as the first sheet in the workbook. 2. Copy the code below. Press ALT + F11 to open the VBA window, click Insert, Module and paste the code. Sub CombineAllSheets() Dim osheet As Object For Each osheet In Sheets If osheet.Index > 1 Then osheet.Activate Range("A1", osheet.UsedRange.Cells _ (osheet.UsedRange.Cells.Count)).Select Selection.Copy Sheets(1).Activate Cells(Sheets(1).UsedRange.Cells _ (Sheets(1).UsedRange.Cells.Count) _ .Row + 1, 1).Select ActiveSheet.Paste Application.CutCopyMode = False End If Next Sheets(1).Cells(1, 1).Select End Sub 3. Click the Play button to run the code and copy all the spreadsheets to the first spreadsheet. 18 19