WEEK-1: HOMEWORK/LAB ASSIGNMENTS INTRODUCTION TO ...

33 downloads 394 Views 533KB Size Report
Lab-1: Finish the tutorial and then solve problems 1, 4, 5, 6, and hand solve 7 in ... handout is prepared with instructions to be used in Microsoft's Excel 2007.
WEEK-1: HOMEWORK/LAB ASSIGNMENTS INTRODUCTION TO EXCEL

LEARNING OBJECTIVES (WEEK-1) 1. To learn basic Excel concepts (various copy/paste options, drag down issues, print screen and create word reports, fixed and relative cell addressing, creating professional looking black/white (not haphazard!) graphs). We will cover this in one or two lectures. Lab-1: Finish the tutorial and then solve problems 1, 4, 5, 6, and hand solve 7 in your homework then show it to the tutors and get a check mark on the attendance sheet before you leave.. DEVELOPMENT OF LOAN AMORTIZATION TABLE In this exercise, we will learn how to use spreadsheets to solve simple accounting problems. We will also learn how easy it is to use multiple formulas within Excel. The handout is prepared with instructions to be used in Microsoft’s Excel 2007. Some of the instructions are similar if an earlier version of Excel is used; however, it is required that you use Excel 2007 or a later version for all the exercises in this class. Loan Amortization tables show how much you owe a bank every month when you borrow money from them. This specific problem is a useful practical example adapted from a problem discussed in Engineering with Excel, by R.W Larson. Let us assume that you recently graduated and bought a brand new Ford Mustang (with cool white stripes, of course!). Thanks to government bailouts you got a nice deal of $25,000 at an annual percentage rate (APR) of 6%, with no down payment. You want to pay the loan within 5 years. In this exercise, you will create an amortization table (monthly basis) that shows your payment, how much went as interest, how much principal was paid, and the amount you owe to the bank. The primary concept in preparing this table is that, each time you make a payment, you have to pay interest on the outstanding borrowed amount, called Principal. The amount that exceeds the interest amount paid reduces the principal before the next payment. Before we proceed into the detailed calculations, we have to set up a spreadsheet for your loan. We will design a general layout to organize information and make it easy to understand.

1   

Figure 1.0 Setting up the spreadsheet

Figure 1.1 Spreadsheet’s layout after setting the column width Click on the cell A1 and type “Loan Amortization Table”. It can be observed that the cell width is insufficient to fit the contents of the cell. To adjust the cell size, move the cursor to the area shown in Figure 1.0 and click and drag to resize the cell width. Alternatively, you can double click in the area to automatically adjust the cell width to fit the contents. Make the font bold; this is the heading for the worksheet. Every worksheet should have a heading; this is not a necessity, but it is recommended to keep the spreadsheet organized. Click on cell A3 and type “Loan Amount”, “APR” in cell A4, “Loan Term” in cell A5, “Payments/year” in the cell A6. These are called labels. If the worksheet is filled with numbers, it will be difficult for the user to understand it. So, we give names to each number to communicate with the end user what each number means. Always use appropriate labels. Enter the value 25000 in cell B3, 6% in B4, 5 in B5 and finally 12 in B6. We have now entered all input data needed for our calculation. Now we can additionally format the cells to make them more presentable. Since the loan amount is in dollars, we should tell Excel that the number in cell B3 is currency. This can be done by right clicking on the cell B3 and then clicking on the “Format cells” option. Click on the “Numbers” tab and choose “Currency” and click OK.

2   

Figure 1.2 Formatting cells to display currency.

Figure 1.3 Loan amount displayed as currency. As observed in Figure 1.3, the loan amount is displayed in currency format and hence has a $ symbol before the value. You could also change the color and make the labels bold. Play with the formatting a little to differentiate the input values from the end results. Since we make the payments every month, it is necessary to calculate the periodic interest rate. The APR is 6%; therefore, the interest rate for each month would be (6/12) = 0.5%. The loan term is 5 years; hence the loan will be repaid in 12*5=60 payments. We should add this additional information into the spreadsheet with appropriate labels. Assign different colors to the cells to differentiate the input, output and titles. To change the color of a cell, select the cell and click on the button highlighted by a red box in the Figure 1.4. Pick an appropriate color from the list. 3   

Figure 1.4 After entering additional information (Black box on top shows the cell color button) Enter “Total payments” in cell A7 and in cell B7 enter the formula “=B5*B6”. Type “Periodic Interest Rate” in cell A8 and in cell B8 enter the formula “=B4/B6”. To ensure that your number displays as a percentage, Right click on cell B8, select “Format Cells”, Click on the “Number” tab, Select “Percentage” and change the “Decimal places” to 1 as shown in Figure 1.5. Finally we calculate the monthly payment amount from the periodic interest rate, principal amount and total number of payments. The payment per month can be calculated using the formula (which you will learn in your engineering economics class):

∗ . .













.

Enter “Payment amount” in cell A9 and enter the formula “=B3*B8/(1-((1+B8)^B7))” in cell B9. This number is currency, so follow the instructions as before and change the cell to display the value as currency. Now the spreadsheet has all the data required to build the amortization table.

4   

Figure 1.5 Changing the numbers to percentage. Now set up the spreadsheet to calculate the payment information for every month. This should calculate the interest for each month based on the principal, the amount of money paid towards the principal after subtracting the interest amount and finally the principal amount after the payment. Set up the spreadsheet as shown in Figure 1.6.

Figure 1.6 Setting up the spreadsheet to calculate periodic payments. To ensure that your text fits the cells, you should select the cells and right click on them and choose the “Format cells” option, click on the “Alignment” tab and check the “Wrap text” option. The text you entered into the selected cell will automatically fit into the cell.

5   

Figure 1.7 Wrap text in the cell. The principal amount for the first payment is simply the same amount that was originally borrowed from the bank. So we will enter the formula “=B3” in the cell C12. Now the interest on this amount is calculated using the simple interest formula i.e. “Principal amount before payment * periodic interest rate”. The periodic interest rate is the same for every month; therefore, we must use an absolute address when we use the periodic interest in the formula. By using the absolute address, we make sure that the input value does not change when we copy the formula. Remember, as we discussed in class, absolute addressing can done by explicitly typing two dollars signs in front of a cell address or by pressing F4. Two dollar signs imply that the cell copied along a row or column will have a fixed value. However, if you put just one dollar sign in front of an address (e.g. $F8) then the column indicated by F will stay constant but the row numbers will change. On the other hand if you put a dollar sign in front of the number (e.g. F$8) then the row number 8 will remain constant and the columns will change automatically when you copy.

Figure 1.8 Calculate the interest amount for each payment

6   

We subtract the interest from the monthly payment of $483.32 to calculate the amount paid on the principal. We will use absolute addressing when we reference the cell with monthly payments, as this stays constant throughout the calculation.

Figure 1.9 Calculating the amount paid on principal Finally, we subtract the “amount paid on principal” from the “principal amount before payment”. This will be principal amount for the next month’s payment.

Figure 1.10 Calculating the principal after payment This completes the calculation for the first payment. Now we can calculate the amount of interest and principal paid by the second payment. The principal for the second payment is equal to the principal amount after the first payment. So enter the formula “=F12” in C13.

Figure 1.11 Beginning the calculation for the second payment To calculate the rest of the entries in this table, all we have to do is copy the formula for cells D12 to F12. This can be done in a couple of ways: Select all cells from D12 to F12 and right click on them and select “Copy”. Next right click on the cell D13 and choose “Paste”. This calculates all the entries for the second payment.

Figure 1.12 Calculating the second payment using the copy paste method The second way to accomplish this is to select the cells for D12 to F12 and move your mouse to the bottom corner of the selected cells as shown in Figure 1.13. 7   

Figure 1.13 Calculating the second payment using the click and drag method When the mouse arrow turns to the + button as shown in Figure 1.13, click and drag to the next row. This will calculate all the entries for the next payment.

Figure 1.14 Calculating the entries for the second payment Calculating the next 58 entries is a breeze, as we just have to copy the formula from cells C13 to F13 and paste it in the next 58 cells either by using the copy-paste method or the click-and-drag method. In the copy-paste method, select all the cells from C14:F14 to C71:F71, right click on the cells and choose paste. However, when using the click-and-drag method, all you have to do is to select the cells C13 to F13 and click at the bottom corner, then drag down to C71:F71 cells. Excel will automatically fill all the entries for the next 58 payments. Figure 1.15 shows the amortization table for the first 10 payments.

Figure 1.15 Completed loan amortization table for the first 10 payments. Notice that the table was already configured to show the $ sign for the all entries. Ensure that proper formatting is followed to improve the appearance and readability of the table.

8   

INTRODUCTION TO EXCEL - 2 EXCEL GRAPHING 2.1 GENERATING A PLOT FROM A DATA SET: In this exercise, we will learn to plot graphs using Microsoft Excel 2007. To plot a graph, we need data that can be graphed. We will use a simple line equation, y= mx + c to generate the data for this graphing exercise. In this equation, m is the slope of the graph and c is the intercept. To generate the data, we will assume the x values in the range [0, 10]. Also, the slope of the line, m, is 0.1 and the intercept, c, is 2. We can utilize Excel’s copy-paste method to quickly generate the data. First, set up the Excel spreadsheet as shown in Figure 2.1.

Figure 2.1 Setting up the spreadsheet for graphing Enter the formula “=$B$2*A4+$B$1” in cell B4. We use absolute referencing for both c and m because we do not want them to change when we copy-paste the formula. Copy the formula in cell B4 down to cell B14 to generate all the points for y. Once we have the x and y values, we have sufficient data to plot a graph. Select the cells from A3:B3 to A14:B14. Click on the Insert ribbon and choose “Scatter” from the Charts group. In the scatter sub-menu, select “Scatter with smooth lines and markers”. Figure 2.2 shows the complete picture and Figure 2.3 shows the generated graph.

9   

Figure 2.2 Shows the insert menu and scatter with smooth sub-menu

Line Graph 3.5 3 2.5 Y

2 1.5 y

1 0.5 0 0

2

4

6

8

10

12

X

Figure 2.3 Shows the generated plot. We can set the chart title and the axis titles from the “Layout” ribbon in the Chart Tools tab. All charts must be labeled with appropriate titles.

10   

2.2 GENERATING A PLOT FROM MULTIPLE DATA SETS: To generate a graph from multiple datasets, we need to first create the multiple data sets. In this example, we will create these data sets by using the same line graph problem with different slopes. Consider m = 0.1, 0.2, 0.3, 0.4 and 0.5. Now, recreate the layout as shown in Figure 2.4 and generate the data for the other 4 lines using the formula y = mx + c.

Figure 2.4 Setting up the spreadsheet for multiple graphs To generate multiple graphs from scratch, we just have to select all the data A3:F3 to A14:F14, click on the “Insert” ribbon and choose “scatter” and follow the instruction for plotting a graph. The graph will be displayed as shown in Figure 2.5.

Multiple Lines 8.00 7.00 6.00

y

5.00

y at m=0.1

4.00

y at m=0.2

3.00

y at m=0.3

2.00

y at m=0.4

1.00

y at m=0.5

0.00 0

2

4

6

8

10

12

x

Figure 2.5 Multiple lines in the same graph

11   

To add a line to an existing data set, we can copy the new data and paste it on the graph. We could also click on the graph and this would highlight the cells on the spreadsheet that are included in the graph. You can then add additional data to an existing graph by extending the selected cells boundary (blue boundary shown below) to include the adjacent columns as shown in Figure 2.6. Finally, we could right click on the chart and click on the “Select Data” option and click on “Add” to add a new series.

Figure 2.6 Adding data to an existing graph.

2.3 DEVELOPING PROFESSIONAL LOOKING GRAPHS: The graphs shown above are some figures that can be rapidly prepared using EXCEL. While they look reasonable on the screen, they lack professional quality. Figure 2.7 below shows a nice, professional-quality graph for the same problem. In order to improve the quality of the graph, do the following: Pay attention to the details and reproduce all the aspects shown in the figure below. Note all the lines are in black and white, no colors are used. Right click on the horizontal axis numbers and select Font and change fonts to Arial 11 point; repeated the same for the vertical axis. Right click on the horizontal axis number and select format axis. Under Axis Options, fix the minimum to zero, maximum to 10, major unit to 1.0. Go to Line style and increase it to 1.5 pts; go to Line color and select black. Select Number and use 1 decimal place. Right click on the horizontal axis number and select format axis. Select Major tick mark type to “Cross” and this will make the tick marks cross the axis line.

12   

Right click on each of the lines, select “Format Data Series,” and modify the “Line Color” to solid line and select black, change the Line style to 1.5 pt, and selected the appropriate Dash type. Select Marker option, build-in and select the appropriate symbol. Select Maker Fill and, select solid fill and select black. You might also want to check other options. Repeat the same for all the lines. Right click on the axis label (value of X) to select to the font to Arial 12 point bold. Repeat the same for other axis. For creating axis titles and editing the titles or other such formatting functions, click on the graph and this will take you to the “Chart Tools” tab on the top, then select “Layout.” In the Layout tab and under Gridlines get rid of the horizontal grid lines. Select the plot, right click and select Format Plot area, change the border color to solid line, black, and the border style to 1.75 pts. The label box can be moved into the graph by simply selecting it and dragging it into the plot.

Clement's Multiple Lines 8.0 Y at m=0.1

7.0

Y at m=0.2

Value of Y

6.0

Y at m=0.3 Y at m=0.4

5.0

Y at m=0.5

4.0 3.0 2.0 1.0 0.0 0.0

1.0

2.0

3.0

4.0

5.0

6.0

7.0

8.0

9.0

10.0

Value of X Figure 2.7 Professionally presented graph.

13   

2.4 USING EXCEL GRAPH TEMPLATES TO EASILY RECREATE PROFESSIONAL LOOKING GRAPHS Once you have created the graph in Figure 2.7, you can save it as a chart template. If you have to plot a similar graph next time then you can simply reuse this EXCEL template. This will save you a lot of time and effort. Follow the following steps below to learn to use templates. Step 1: Go to the design Tab and select “Save as Template” on the right top corner as shown below. Give a suitable name to your template say “Professional template1”.

Step 2: Next time you need to use the template you created, first select the data you want to plot and plot it using suitable chart type.

14   

Step 3: Next move your chart to a separate sheet. This will prevent legends being misplaced.

Step 4: Finally, change chart-type to your template using “change chart type” button. This will give you the graph of the template you want. Note: you have to save the template in your own drive if you are using a CE computer so that you can have copy of it with you.

15   

2.5 PLOTTING MULTIPLE FUNCTIONS WITH VARYING MAGNITUDES (ADDING A SECONDARY AXIS) Table 1. Detention pond data Time (hr)

Qin (cfs) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

0 296739 359963 327493 264846 200796 146147 103417 71686 48915 32965 21993 14552 9562 6246 4059

Qout (cfs) 0 66168 112505 141706 158367 165877 166730 162755 155287 145297 133490 120375 106316 91578 76349 60764

Depth (ft) 0.00 1.31 3.80 6.03 7.53 8.26 8.35 7.96 7.24 6.34 5.35 4.35 3.39 2.52 1.75 1.11

While analyzing engineering problems, often one encounters data for a system that has vary in several orders of magnitude.. For example, the table above provides data for a detention pond where inflow rate, outflow rate, and the depth of the pond are measured over time. As you can see from this table, the numbers used for describing the depth variations are considerably smaller than the flow rates. If you blindly plot this data using time as your x axis, it will be impossible to see the depth variations. Try this first! An approach to resolve this problem is to use two different scales for your Y-axis. We will use a larger scale for Q, which will be shown on the right axis, and a smaller scale for h, which will be shown on the left axis. To accomplish this, first plot all three graphs in the standard way. Now right click on the curve (height curve) that could not be viewed clearly. Now select “Format Data Series” option and then select secondary axis option button. This will automatically create a secondary axis. Now go ahead and clean up your graph and make a professional looking graph, as the one shown below.

16   

Figure 2.8 Showing the secondary axis option 400000

10.00

350000

9.00

Qin(cfs) Qout(cfs) depth (ft)

300000 7.00 250000

6.00

200000

5.00

150000

4.00

Height (ft)

Flow rate (Q in cfs)

8.00

3.00 100000 2.00 50000

1.00

0

0.00 0

2

4

6

8

10

12

14

16

Time (days)

Figure 2.9 Excel figure demonstrating the use of a secondary axis Think of a problem similar to the above example that you might have come across. You will have an exercise involving this in the next week’s homework (see HW#2, last problem).

17   

Home work problems (week-1) 1) Do Exercise-1 and submit the final amortization table with the title showing: “Clement’s Loan Amortization Table.” Use your name instead of Clement. 2) Prepare the new amortization table (also showing your name on cell A1) for a loan amount of $30000, APR of 8% and a loan term of 8 years. . Print some key portion (about a page or two) of the amortization table with neat formatting. What is the total amount of interest you would pay to the bank over the 8-year loan period? 3) What is the difference between absolute cell addressing and relative cell addressing? How is it implemented in EXCEL? Give three example problems (make up your own 3 simple examples) where you can use the following concepts when copying cells: a) fix rows using fixed cells or using the $ sign, b) fix columns alone using the $ sign, c) fix both columns and rows using two $ signs. Give real example problems (for example, computation of area of multiple circles by fixing the value of PI is a good example for question 3c). 4) Complete the above line graphing exercise and print a good, professional quality graph. Modify the title like this: “Dr. Clement’s Multiple Lines.” Use your name, instead of “Clement.” 5) Repeat the above problem for a fixed value of m=2 and for various values of intercept c=0.5, 1. 1.5, 2, and 2.5. Plot the data and provide a printout of the final graphs with a title showing your name. 6) Hydrographs are used by civil engineers to model rainfall-runoff processes. A simple analytical model for describing a stream hydrograph after a rainfall event (i.e., increase in stream flow as a function of time) can be described by the model: Q(t) = a * (t/b)^n * exp[n- (n*t/b)], where a and b are constants known as model parameters, t is the time in hrs, and Q is the flow in the stream in ft3/hr. a) Use EXCEL to implement the above design equation and plot Q(t) for t ranging from 0 to 20 hours (with a step of every 0.25 hrs). Use n = 1, b=3 and generate four hydrographs for a = 200,000; 300,000, 400,000, and 500,000. Plot all four graphs together (good quality graphs) and comment on the shape of the graphs. What happens when we vary the constant “a”? Does “a” represent any meaningful physical quantity? b) Plot Q(t) for t ranging from 0 to 20 hours (step of every 0.25 hrs). Use n =1, a=300,000 and generate four hydrographs for b = 1, 2, 3, and 5. Plot all four graphs together (good quality graphs) and comment on the shape of the graphs. What happens when we vary the constant “b”? Does “b” represent any meaningful physical quantity? 7) Seven different formulae are defined in cell B2: for Case-1) =A2*B1, Case-2) = $A$2*B1, Case-3) =A2*$B$1, Case-4) $A2*B1, Case-5) A$2*B1, Case-6) A2*$B1, and Case-7) A2*B$1 a) If we copied the formula across and down (to all the nine cells that are marked as “?”) what will be the EXCEL formula in each of these nine cells for each case? Submit seven spreadsheets (similar to the one below) with an appropriate formula in each cell. b) If we copied the formula across and down, hand calculate the values in the nine cells for each case. Submit seven spreadsheets with an appropriate value in each cell. 18   

DO NOT USE EXCEL, DO IT BY HAND AND THEN CHECK YOUR ANSWER USING EXCEL.

8. Come up with an example problem where you will plot some independent variable  (x values) against 2 or 3 dependent variables (y values) with one of them involving a  dissimilar magnitude.  This is similar to the last plotting exercise (involving two  vertical axes) you did in the lab.  You have to come up with your own data/problem  for a system, discuss the problem, provide the data, and prepare professional  looking plots that use a primary axis and a secondary axis. 

19