Escolar Documentos
Profissional Documentos
Cultura Documentos
Practical Workbook
Versions
This document was written for use with Excel 2007.
Document information
Course files
This document and any associated practice files (if needed) are available on the web. To find these, go to www.bristol.ac.uk/is/learning/resources and in the Keyword box, type the document code given in brackets at the top of this page.
Related documentation
Other related documents are available from the web at: http://www.bristol.ac.uk/is/learning/resources
Microsoft Excel 2007: Scientific examples (August 2010) 2010 University of Bristol. All rights reserved.
Contents
Task 1 Task 2 Task 3 Task 4 Task 5 Task 6 Task 7 Task 8 Task 9 Charting separate data series ............................................................... 1 Using time in charts ............................................................................... 4 Fitting a line to a set of data .................................................................. 7 Array functions (TREND) ....................................................................... 9 Plotting experimental data ................................................................... 11 Refreshable text import ....................................................................... 13 Plotting an arbitrary function .............................................................. 15 Charts: axis formatting ........................................................................ 17 Creating a combination chart .............................................................. 19
Task 10 Plotting data points with error bars .................................................... 20 Task 11 Chart templates .................................................................................... 23
Introduction
Excel is the University's recommended spreadsheet product for Windows on PCs. This document contains illustrative examples. These examples can be worked through exactly according to the notes or you can vary them.
Prerequisites
This document assumes that you have a good level of experience of Excel. You must be able to use the following features: Formulas - covered in the course Microsoft Excel level 1: Getting started (document exl07all2). Charts, range names and functions - covered in the course Microsoft Excel level 2: Making more of Excel (document exl07all-3). See the Related Documentation section in the inside front cover for the location of these documents.
Choose the Insert tab on the Ribbon Select the arrow below the chart type Scatter and choose the fourth subtype, scatter with straight lines and markers.
1.3
To change the series title to Site 1, click the Select Data button
Click the Edit button and type Site 1 in the Series name box. Click OK. 1
1.4
In the Series name box type Site 2. Click in the X Values box then select the range B10:B13. Click in the Y Values box and delete the existing data then select the range C10:C13. Click OK. 1.5 Click the Add button to define Series 3. In the Series name box type Site 3. Click in the X Values box then select the range B17:B21. Click in the Y Values box and delete the existing data then select the range C17:C21. Click OK twice. 1.6 Click the first Chart Layouts button which will add heading placeholders to the chart.
2.5
Create a scatter chart (with lines and markers) for the two series of data: Series Name Patient 1 Patient 2 X Values C4:C11 C18:C27 Y Values D4:D11 D18:D27
Patients' Readings
70 60
Reading
Time
Select cells A4:A11. Click the arrow on the Number group of formatting options.
From the Number tab, choose the Custom category. Choose the format hh:mm. Click OK.
The dates are now hidden on the X axis, but the shape of the chart is unchanged. 2.8 If you have a lot of dates to enter, the method shown in the Time 4 sheet will speed things up.
Examine the Time 4 sheet, especially the formulas. Columns D and E contain the plotted data.
3.4
3.5
Click the arrow below the Trendline button. Select More trendline options (see Figure 12).
In Trendline Options select Linear. Tick (at the bottom of the box) Display Equation on chart and Display Rsquared value on chart. Click on Close. 3.6 3.7 Drag the box containing the Equation and the R-squared value to a suitable position on the chart. Save the file. As can be seen in Figure 13, the results accord very well with the theory (an Rsquared value of 1 would represent a perfect fit).
4.2
Enter in A10:A14 the new values shown in Figure 14 to represent the new loads for which the length of the spring will be predicted:
Highlight the range B10:B14, which will be used to hold the predicted values. Click the Insert Function icon Click OK. In the resulting dialog box, enter the data values as shown in Figure 15, by clicking each box in turn and highlighting the range of cells in question. , select the TREND function.
Do not click on OK at this stage. 4.3 4.4 Note The Formula Bar should now read as follows: =TREND(B4:B9,A4:A9,A10:A14). To enter the array function do not click on OK, but hold down <Ctrl> and <Shift> and then press <Enter>. This is the method used to enter array functions (that produce multiple results), rather than simple functions. The set of numbers in the range B10:B14 represent the predicted length of the spring for the corresponding loads. Note Or, to do this without an array: Use the Insert Function method to enter this formula in B10 =TREND(B4:B9,A4:A9,A10) Alter it to contain absolute references to the existing data by adding dollar signs where shown: =TREND($B$4:$B$9,$A$4:$A$9,A10) Copy the formula to B11:B14. Format the numbers to 2 decimal places. To add these data to the original chart:
4.5 4.6
Right click the chart. Choose Select Data. Click the Edit button. Delete and replace the X and Y series values by highlighting the cell ranges. Click OK twice. Note In the TREND function, the parameter const determines whether or not the line is to pass through the origin; if omitted, or if the value is TRUE, the constant will be evaluated. If the value is FALSE, the line will be forced to pass through the origin. For the purposes of this example, leave Const blank.
10
In Excel, open the file C:\User\Excel\data1.csv. Insert two new rows above the data starting in cell A1. Click in cell A9 and enter the formula to calculate the average for the values in cells A3:A6 =AVERAGE(A3:A6) Copy this formula to cells B9:AW9. To create the chart:
5.4 5.5
Select the data range A9:AW9. Choose the Insert tab on the Ribbon Select the arrow below the chart type Line and choose the second subtype, stacked line chart.
11
Add the chart title Average Values. 5.6 Remove the horizontal gridlines: From the Layout tab click the arrow below Gridlines. Choose Primary Horizontal gridlines Select the option None. 5.7 Remove the legend (see Figure 18): From the Layout tab click the arrow below Legend. Select the option None.
5.8 5.9
12
Comments
6.1
From the Start menu, choose Programs then Accessories and Notepad. From the File menu, choose Open. From the Files of Type box, select All Files. Find the file C:\User\Excel\data1.csv and click on Open. You will see 4 lines of data separated by commas; the data is known as comma delimited. Close Notepad. 6.2 6.3 In Excel, create a new, blank workbook and click on cell A1. From the Data tab, in the Get External Data group, select From Text..
Navigate to the file C:\User\Excel\Data1.csv and click on Import. 6.4 Use the Text Import Wizard as follows: In Step 1, to accept Delimited as the file type, click on Next. In Step 2, under Delimiters, untick Tab and tick Comma to determine how the data is separated then click on Next. In Step 3, leave the Column data format as General then click on Finish. 6.5 6.6 6.7 6.8 Click on OK to place the data in cell A1 of your current spreadsheet. Work with the data in the same way as in steps 5.2 - 5.5 from Task 5. Save the file as Task6. In NotePad, open the file C:\User\Excel\data1.csv.
Make an obvious change to the data (for example, change the first entry from 10.36503 to 5). Save the file. Switch back to Excel and click on the worksheet, within the range A3:AW6. From the Data tab select Refresh All. 13
Note
Care should be taken when the original data file is extended rather than simply modified as new data sets will not automatically be included in the range used by the chart. In this example, additional rows of data will be included in the average value calculations, but values added after the 49th on each row will not. Any necessary formulae should be extended. If necessary, extend the data range plotted in the chart as described in 4.6. To obtain data from Microsoft Access, start from Access, select a table or query and from the File menu, choose Export. Save the data as a workbook in the latest Microsoft Excel format. There are choices to save the existing formatting (column widths) and to automatically start Excel opening the newly created file.
Note
14
7.2
Use the Name Box to check that the names A, B, CC, D and E apply to cells C4, C5, C6, C7 and C8.
7.3
The values for x will start at 0 and be increased successively by the value in cell I3, the typical plotting increment (0.04). I3 has been named Inc for ease of use in the formula you will create. See Figure 21. Now set up the X plotting range. To get a smooth curve, we need at least 50 points.
Use the Name Box to check that the name Inc applies to cell I3. 7.4
Cell B10 has the starting value, of 0. In cell C10 enter the formula: =B10+Inc. Copy this formula to the range D10:AZ10. 7.5 Enter the formula to calculate the Y values produced by the function as follows: Select cell B11 and enter the formula: =A*B10^3+B*B10^2+CC*B10+D+E*(SIN(3*B10))^2. Copy this formula from B11 to the range C11:AZ11. See Figure 22
15
You can now see the nature of the function. The parameters A, B, C, D and E and also the plotting increment, Inc, can be easily changed and the effects observed. This ability to explore the nature of complex functions is one of the key features of a spreadsheet. 7.6 Save the file. In the next task you will plot a chart of the function.
16
8.1
Continue using the Scientific workbook and the Function sheet. If you have not done the previous exercise, use the Function 2 sheet. Chart the data in the range B10:AZ11 using a scatter chart of the third type with smoothed lines and no markers. You will see in Figure 23 that the X-axis origin is displayed on the Y-axis (above the point -2.00).You will remove it for cosmetic reasons. You will also change the number of decimal places displayed for the X-axis figures.
8.2
8.3
From the Layout tab, click the arrow below Axes and choose Primary Horizontal Axis.
17
Select More Primary Horizontal Axis Options. 8.4 Select the Number option. See Figure 25. Click the category Custom Click in the Format Code box and type 0.0;-0.0;;. This means: positive and negative numbers will have one decimal place, zero will not be displayed and text formatting is not being considered. Click Add.
Click Close. 8.5 8.6 Remove the legend. Save the file.
Note that this will include the totals. Your chart will look like the one below:
It is not that helpful having the totals charted as columns alongside the raw data. It would be more helpful to have the totals showing as a line chart which would give a clearer idea of total sales over the year. 9.4 9.5 Click on one of the totals columns to select the whole data series On the Chart Tools: Design tab, click on Change Chart Type then click OK.
It is now easier to see the gradual increase in total vehicle sales over the year.
19
10.4
Click the chart to edit it. From the Layout tab select Error Bars (see Figure 29).
20
Choose Custom then click Specify Value. The Custom Error Bars dialogue box opens.. For both the Positive Error Value box and the Negative Error Value box in turn, delete the existing data then select C2:C102.
22
Select A2:B7. Create a chart of the type: Scatter with only markers, ie type 1 Select the chart. To make a selected chart match a template, on the Design tab, in the Type group, click Change Chart Type. Click the Templates folder at top left. In My Templates, on the right, click the icon for the template that you want to use. Click OK. The graph should appear with all the preferences, eg axis settings, as applied to the original graph. Warning! 11.2 When Excel constructs the error bars for the new set of data; it gets them wrong (it uses the old ones). Set the correct error bars using the method shown at 10.4.
23
Click Manage Templates. Do one of the following: To delete the chart template from your computer, right-click it, and then click Delete. Close the window. In the Insert Chart dialog box click Cancel.
24