Microsoft Excel 2003 Data Analysis Larry F Vint, Ph.D lvint@niu.edu 815-753-8053 Technical Advisory Group Customer Support Services Northern Illinois University 120 Swen Parson Hall DeKalb, IL 60115 © Copyright 2004 Northern Illinois University Information Technology Services Microsoft Excel 2003 Data Analysis Using Excel’s Data Analysis Tools Tables Evaluating Trends 11 Using Excel's Goal Seek 17 Using Solver 20 Creating Scenarios 23 © Copyright 2004 Northern Illinois University Information Technology Services Using Excel’s Data Analysis Tools Excel includes a number of add-in tools to assist with a number of data handling, reporting and analysis functions Click on the worksheet tab labeled Data Analysis Click on the Tools pull-down menus Click on Add-Ins Check Analysis ToolPak as in Figure DA-01 Also Check Solver as we will be using the Solver in a later exercise Click OK This unpacks the chosen Excel Add-in tools and makes them available for use If the Addin list is empty, there may have been a limited installation of MS Office If this is the case, the MS Office CDs will be needed to install these Add-in tools Click on the Tools pull-down menus again Click on Data Analysis Select Descriptive Statistics from the Analysis Tools as in Figure DA-02 Figure DA-01 10 Click OK The Descriptive Statistics box is shown in Figure DA-03 Figure DA-02 Figure DA-03 © Copyright 2004 Northern Illinois University Information Technology Services 11 Click on the contract button for the Input Range box 12 Highlight B1 through C7 13 Click the expand button 14 Check the Labels in First Row box 15 Click on the contract button for the Output Range box 16 Click on cell A11 17 Click the expand button 18 Check the Summary Statistics box The Descriptive Statistics window should now look like Figure DA-04 19 Click OK 20 The output will be crowded so highlight the column headings for columns A through D 21 Position the cursor over the right-hand border of one of the highlighted columns and double-click to increase the width of each column to the widest cell in the column Figure DA-04 The resulting Descriptive Statistics should look like Figure DA-05 Figure DA-05 © Copyright 2004 Northern Illinois University Information Technology Services Let’s try another analysis Regression statistics can be useful in evaluating past trends and predicting future consequences Using the data in the Data Analysis worksheet, let’s compute the regression of Expenditure increases as a function of the number of Students 22 Click on the Tools pull-down menus again 23 Click on Data Analysis 24 Select Regression from the Analysis Tools 25 Click OK 26 Click on the contract button for the Input Y Range box 27 Highlight B1 through B7 28 Click the expand button 29 Click on the contract button for the Input X Range box 30 Highlight C1 through C7 31 Click the expand button 32 Check the Labels box 33 Click on the contract button for the Output Range box 34 Click on cell E1 35 Click the expand button The Regression window should now look like Figure DA-06 36 Click OK 37 The output will be crowded so highlight the column headings for columns E through M 38 Position the cursor over the right-hand border of one of the highlighted columns and double-click to increase the width of each column to the widest cell in the column The resulting Regression Statistics should look like Figure DA-07 Figure DA-06 © Copyright 2004 Northern Illinois University Information Technology Services Figure DA-07 The coefficient for STUDENTS, 5069.547647, indicates that every student adds $5,069.55 to EXPENDITURES and that even with no students there would be $12,763.11 in EXPENDITURES Let’s use these coefficients to set up an equation to predict EXPENDITURES based upon student numbers 39 Click on cell P3 40 Type = 41 Click on cell F17 42 Type + 43 Click on cell F18 44 Type * 45 Click on cell O3 46 Press Enter These steps have created a prediction equation based upon the regression analysis that can be used to predict expenditures for varying numbers of students Care must be taken in interpreting results greatly beyond the range of existing data; i.e the prediction may be reasonable for 20 students, but not realistic for 100 students 47 Click on cell O3 48 Type 20 49 Press Enter The equation predicts that if we had 20 students we could expect expenditures to be $114, 154.06 The above examples illustrate some of the types of statistical analysis that can be performed with Excel’s Add-in Analysis ToolPak © Copyright 2004 Northern Illinois University Information Technology Services Tables Most people familiar with databases will mistakenly assume the Tables feature in Excel is used similarly but they are mistaken The Tables feature in Excel is another What-If analysis tool that displays the result of a formula with different sets of input values For this example we will create a formula that determines the monthly payments for the principal of an investment given a fixed interest rate We will use the PPMT function that is one of the financial functions provided by Excel to calculate the monthly payments to be made on an investment over a specified period of time We will enter the interest rate, Let’s first go to the Payment Table worksheet for the function and ensuing table Click on the Payment Table worksheet tab Let’s enter the input values for the function first and then create the function Click on cell B1 Type 7.5 Click on cell B2 Type Click on cell B3 Type 18000 These three values will be used by the PMT function to calculate the monthly payments Let’s enter the formula Click on cell B6 Click on the Paste Function toolbar button 10 From popup Insert Function window click on the Financial category from the select a category pick list 11 Scroll down the list box labeled Select a function until you see the PMT function and click on it as in Figure PT-01 12 Click on the OK button The formula box appears listing the arguments needed by the PMT function The three required arguments, Rate, Nper, and Pv, are indicated in boldface Two optional arguments are Fv and Type Figure PT-01 © Copyright 2004 Northern Illinois University Information Technology Services 13 To better understand the arguments needed for the PMT function click on Help on this function We can now see that Fv and Type are the future value and payment method, respectively The future value is the balanced desired after the last payment was made If no argument is supplied to this argument the default is zero The Type argument is used to indicate when the payment is made A value of True indicates the payment is made at the beginning of the period and a value of False or if this value is not supplied the payment is made at the end of the period We will supply the three required arguments since we want to attain a zero balance after all payments are made and the payments are made at the end of each pay period 14 Click within the box labeled Rate 15 Type (B1/12)/100 Cell B1 contains the annual interest rate Since we wish to determine the monthly payments we must express on all arguments in monthly units So dividing the annual rage by 12 months will give us the monthly interest rate We then divided the monthly interest rate by 100 to express on the percentage as a decimal number 16 Click within the box labeled Nper 17 Click on the Contract dialog box button to the right of this box The formula box will be temporarily suppressed and the box containing the Nper argument is displayed Whenever we click on a cell Excel will fill the cell address into the Nper argument box 18 Click on cell B2 The cell address B2 is placed within the Nper argument box 19 Click on the Expand dialog box button The Nper argument box will contain the cell address B2 that contains the pay period that is expressed in years Just like the Rate argument we must express the Nper argument in months So we must multiply the contents of cell B2 by 12 20 Click on the End key to move the insertion point to the end of the argument 21 Type *12 The Nper argument should now read B2*12 22 Click within the box labeled Pv and click on the Contract button Figure PT-02 © Copyright 2004 Northern Illinois University Information Technology Services 23 Click on cell B3 and then click on the Expand dialog box button The Pv argument is the principal value We will not supply any arguments for the Fv and Type arguments because we want the future value of this investment to equal zero when the pay period ends and we are paying at the end of each month, which are the defaults when an argument is not supplied Figure shows the formula box now Compare your formula box to the figure and correct any mistakes The value of each argument is evaluated and displayed to the right of the argument boxes The monthly interest rate, which is expressed as a decimal value, is 00625 The number of periods is 60 months and the principal value is 18000 24 Click OK A negative value of $360.68 is displayed in cell B6 The payment is negative because it is the amount we must pay each month to pay off an $18,000 investment at 7.5% for years Suppose you want to see how the monthly payments will change when the annual interest rate and pay period are modified We can set up a table to perform this what-if analysis The table will display the input parameters along the top row and left-most column with each cell within the table displaying the formula result for each combination of input values To set up the table, the formula must be in the top, leftmost column Then the input values are entered on the same row beginning in the next cell to the right of the formula and on the same column beginning with the next cell below the formula 25 Position the cursor on cell B7 then continuously hold the left mouse button down 26 Drag the mouse pointer down to cell B9 and then release the mouse button The cell range B7:B9 should be highlighted 27 Type and press Enter 28 Type and press Enter 29 Type and press Enter We will use the leftmost column to supply different number of pay period values to the PMT function 30 Now position the cursor on cell C6 then continuously hold the left mouse button down 31 Drag the mouse pointer to cell D6 and then release the mouse button The cell range C6:D6 should be highlighted 32 Type and press Enter 33 Type 6.5 and click on the fill handle of the highlighted range C6:D6 © Copyright 2004 Northern Illinois University Information Technology Services 34 Continuously holding down on the left mouse button, drag the fill handle to column K, until the number 10 appears, and release the mouse button We allowed Excel to use the pattern of 0.5 percent increases to set up a list of interest rates from six to ten in 0.5 increments Now we can use row six to supply these different interest rate values to the PMT function Figure PT-03 shows the column and row input values for this table along with the function To set up the What-if table showing what payments would be across this range of payment periods and interest rates: 35 Position the cursor on cell B6 and hold the left mouse button down Figure PT-03 36 Drag the mouse pointer to cell K9 and release the mouse button The cell range B6:K9 should be highlighted and if is not then repeat steps 35 and 36 above You must highlight the entire cell range that will display the results of the table and the formula must be in the top, leftmost cell of the table 37 Click on Data in the dropdown menus 38 Click on Table A dialog box entitled Table appears with two options labeled Row input cell and Column input cell We must specify the cell range containing the row input values within the table and the cell range containing the column input values 39 Click within the box labeled Row input cell 40 Click on the Contract button 41 Click on cell B1 The cell address $B$1 should be filled into the Row input cell box Cell B1 contains the annual interest rate and the table will replace the interest rate using the five values entered in cells C6, D6, E6, F6, and G6 42 Click on the Expand button to return to the Table dialog box 43 Click within the Column input cell box 44 Click on the Contract button 45 Click on cell B2 © Copyright 2004 Northern Illinois University Information Technology Services Evaluating Trends Excel has a number of tools to assist in analyzing trends in data Trend analysis can be utilized to predict future results In this section we will use Excel’s Trendline tool to analyze several possible trends in a department’s tuition income We will then utilize Excel’s Linear and Growth Trend tools to predict future tuition income based upon past results Click on the Trends worksheet tab A chart has been created from the data range B7:C11 We will add a series of trendlines to this chart and evaluate how well they describe the existing data Right-click on one of the blue columns representing a data point in the chart Click on Add Trendline from the popup menu as shown in Figure ET-01 Figure ET-01 Figure ET-02 shows the types of trendlines that can be to the chart Excel offers six choices of types of trendlines that might be applied to charted data We will examine visually how well each fits the data We will also display the statistical formulas Excel has computed to calculate data points on the trendline and the R2 values which statistically represent how well the trendline formula describes the data Click on the Linear box as in Figure ET-02 Figure ET-02 © Copyright 2004 Northern Illinois University Information Technology Services 11 Click OK A linear trendline has been applied to the chart Right-click on the trendline The menu that pops up will allow you to either Format trendline or Clear the trendline Click on Format Trendline The Format Trendline window that pops up has three tabs The first, Patterns, will allow you to change the line style, color and weight of the trendline The second, Type, will allow you to change the type of trendline being established Click on the third, the Options tab The Options window in Figure ET-03 will allow us to apply a custom trendline name, forcast forward or backward, reset the intercept on the y-axis, display the trendline equation on the chart and display the Rsquared value on the chart: Check the Display equation then check the Display Rsquared value boxes 10 Click OK The formula y = 146.88x + 231.68 and R2 = 0.9831 appears above the trendline (Figure ET-04) This is the linear regression formula Excel has calculated to describe the tuition income data The R2 value is the percent of variation in the data that is described by the regression equation A value of 1.0 means the equation can completely account for variation in the data The smaller the R2 value the less useful the equation is in describing the data 11 Click in cell C31 (beside Linear) 12 Type in value 9831 13 Press Enter Figure TL6 Figure ET-03 Figure ET-04 © Copyright 2004 Northern Illinois University Information Technology Services 12 Since it is so easy to allow Excel to compute various types of regression equations we will proceed to look at each of the various types of equations and enter their R2 values beside the Trendline Type name in the table in cells B31 to C36 14 Right-click on the trendline 15 Click on the Type tab 16 Choose the next Trendline Type 17 Click OK 18 Click in the cell in column C corresponding to the trendline type and enter the R2 value 19 Repeat steps 28 through 32 until R2 values for all trendline types have been calculated Note that the Moving Average does not compute a regression equation or R2 value This trendline type is based upon the moving average, not a regression equation; therefore, no regression equation or R2 value is relevant to this trendline type Note in the Trendline Descriptive Accuracy table (Figure ET-05) that all of the variation in the data is described by the exponential equation The second degree polynomial equation also does an excellent job of describing the data, accounting for 99.99 percent of the variation Different datasets will yield different results Figure ET-05 Let’s use the exponential equation to forecast for the next ten years 20 Right-click on the trendline 21 Click on the Type tab 22 Choose the Exponential trendline type 23 Click on the Options tab 24 Click in the Forecast Forward: box and enter 10 as in Figure TL9 25 Click OK Figure ET-06 © Copyright 2004 Northern Illinois University Information Technology Services 13 The result of Excel’s forward forecasting using the exponential equation is shown in Figure ET-07 This gives us a clear visual image of predicted future tuition income However, we have no accompanying data points to use for other evaluation purposes To illustrate methods compute these data points proceed to the next page Figure ET-07 One method of predicting future data points in our data is to use the regression equation that Excel has computed for us To so we must understand that in our data the X in Excel’s equation represents an incremental counter starting at one and ending at five for the five data points in our data The value of e (the base of natural logarithms) is 2.71828183 The * is used in Excel to multiply values The ^ is used in Excel to raise values to a power The formula Excel displays as y = 327.68e0.2231x is already coded in cell E7 as =327.68* 2.71828183^(0.2231*D7) In the following steps we will use Excel’s exponential prediction equation calculated from our data y = 327.68e0.2231x to predict future data points First we must unhide cell E7 26 Highlight column headings C through F 27 Right-click then click Unhide in the popup menu 28 Click in cell E7 29 Position the cursor over the fill handle 30 Hold the left mouse button down and drag the fill handle to cell E21 and release it © Copyright 2004 Northern Illinois University Information Technology Services 14 The computed data points now appear in columns E8 through E21 (Figure ET08) Figure ET-08 If linear or growth equations adequately describe the data there is an even easier method of computing future data points 31 Click on cell B7 32 Highlight cells B7 through B11 and position the cursor over the fill handle 33 Hold the left mouse key down and drag the fill handle to cell B21 and release it 34 Click on cell C7 35 Highlight cells C7 through C11 and position the cursor over the fill handle 36 Hold the RIGHT mouse key down and drag the fill handle to cell C21 and release The Trends menu that pops up (Figure ET-09) will allow the choice of either a Linear Trend or Growth Trend to fill in the future data points Since our data was best described by either an exponential or second degree polynomial regression equation we should select the Growth Trend 37 Click on Growth Trend Figure ET-09 © Copyright 2004 Northern Illinois University Information Technology Services 15 The results (Figure ET-10) using are very close to those calculated using the exponential equation; however, they were more easily obtained Note: If we had held down on the LEFT mouse button instead of the RIGHT mouse button as we were dragging the fill handle, a linear trend would have been used to populate our future data points by default Figure ET-10 © Copyright 2004 Northern Illinois University Information Technology Services 16 Using Goal Seek Goal Seek is one of Excel’s what-if tools Goal Seek allows you to • Specify a single adjustable cell • Specify a target value that is dependent upon the adjustable cell • Generate a solution by manipulating the value of the adjustable cell • Generate a single solution to a problem Goal Seek is a relatively easy tool to learn how to use and is a useful tool for finding solutions to complex problems involving a single variable We will use it to find the coefficient required to reach a Department’s goals for growth in tuition income over the next ten years The objective is to predict the coefficient of growth (x) required to achieve a ten-year goal and compute the annual tuition targets leading to that objective It is assumed that the department has $1,000,000 of tuition income in the current year and that tuition income for each future year will increase by (x) times the previous year’s tuition total This data and accompanying chart are present in the Goal Seek worksheet Click on the Goal Seek worksheet tab We want use the Goal Seek tool to compute the growth rate required to reach a goal of $10,000,000 of tuition income in the department by year 2011 The current tuition income in 2002 is $1,000,000 Over the past five years an annual growth rate of 125% has been achieved Using this growth rate the tuition levels over the next ten years has been predicted in the table in the worksheet and charted in the accompanying chart Tuition has been coded to thousands of dollars This predicts the department will fail to reach the $10,000,000 tuition income target in 2011 We will use Goal Seek to determine what the future growth rate must be to reach the 2011 objective Click on cell C17 This is the location of our objective Click on Tools in the dropdown menus Choose and click on Goal Seek The Goal Seek box (Figure GS-01) will appear Our target cell is populated in Set cell: because we clicked on it (C16) before opening Goal Seek Click in the To value: box and enter 12000, the number of thousands of dollars equivalent to the goal of $12,000,000 Figure GS-01 © Copyright 2004 Northern Illinois University Information Technology Services 17 Enter B1 in the By changing cell box as in Figure GS-02 Click OK Figure GS-02 The Goal Seek Status window (Figure GS-03) will announce that a solution has been found and that a Current value of $12,000 (thousands) matched the Target value of 12000 This value has been placed in cell C16 Notice that the tuition values for other years have not yet been changed and the chart does not yet reflect the use of the new coefficient of growth in cell B1 Click OK to accept the solution of 128.21% as the coefficient of growth necessary to achieve the target of $12,000,000 tuition income in year 2012 The newly calculated coefficient is in cell B1 Figure GS-03 Now both the table and the chart reflect the use of the newly computed growth rate in the modified values now present for each year Next we want to visit an alternative way to accomplish the same result Click the undo button on Excel’s standard Toolbar 10 Position the cursor over the 2012 bar In the Department Tuition Income chart and click the left mouse button twice Only the 2012 bar should be active as identified by the size handles on both ends and in the middle 11 Position the cursor over the top of active 2012 bar and hold down the left mouse button when the two pointed arrow appears as in Figure GS-04 Figure GS-04 © Copyright 2004 Northern Illinois University Information Technology Services 18 12 Continuously hold down the left mouse button and drag the top of the bar upwards until the number $12,000 appears then release 13 The Goal Seek box reappears with the Set cell: and To value: boxes filled in (Figure GS-05) Enter B1 in the By changing cell: 14 Click OK The Goal Seek Status window will again announce that a solution has been found and that a Current value of $12,000 (thousands) matched the Target value of 12000 This value has been placed in cell C17 Notice that the tuition values for other years have not yet been changed and the chart does not yet reflect the use of the new coefficient of growth in cell B1 Figure GS-05 15 Click OK to accept the solution of 128.21% as the coefficient of growth necessary to achieve the target of $12,000,000 tuition income in year 2011 The newly calculated coefficient is in cell B1 Both the table and the chart again reflect the use of the newly computed growth rate in the modified values now present for each year For some this alternative way to access Goal Seek through charts may be a more convenient approach Note: Goal Seek and the chart modification method of activating Goal Seek only work with data cells created with consistent formulas that rely on single adjustable cell © Copyright 2004 Northern Illinois University Information Technology Services 19 .. .Microsoft Excel 2003 Data Analysis Using Excel? ??s Data Analysis Tools Tables Evaluating Trends 11 Using Excel'' s Goal Seek 17 Using Solver 20 Creating... Using Excel? ??s Data Analysis Tools Excel includes a number of add-in tools to assist with a number of data handling, reporting and analysis functions Click on the worksheet tab labeled Data Analysis... pull-down menus Click on Add-Ins Check Analysis ToolPak as in Figure DA-01 Also Check Solver as we will be using the Solver in a later exercise Click OK This unpacks the chosen Excel Add-in tools