Graphing With Excel 2003 and 2007 Table of Contents General Excel Skills Bar Graphs for Excel 2003 Pie Charts for Excel 2003 Histograms for Excel 2003 Double Bar Histograms for Excel 2003 Scatter Plot for Excel 2003 Time Series for Excel 2003 Bar Graphs and Pie Charts 2007 and 2010 Histogram for Excel 2007 and 2010 Double Bar Histograms for Excel 2007 and 2010 Scatter Plot in Excel 2007 and 2010 Time Series for Excel 2007 and 2010 1 2 3 4 6 8 9 10 12 15 19 22 General Excel skills 1. To select the cells to be graphed, click in the middle of the upper left most cell, hold the mouse button, then drag to the bottom right corner of the cells you want. Then let go of the mouse button. All the cells should be shaded slightly, except the first cell, but don’t worry, it has been selected. 2. Data Array is the group of cells that contain the data. It can be selected as described above, or by clicking in the first cell then holding down the control and shift keys while you press the down arrow. An example of a data array is A4:A35. These can also be typed into a formula. 3. Formulas always start with an equal sign. If you aren’t sure of the formatting of a formula, which must be done exactly, then click the fx button on the formula bar at near the top of the screen. 4. Statistics Mean Median Standard Deviation =average(data array) =median(data array) =stdev(data array) Page 1 of 22 Bar Graphs for Excel 2003 Bar graphs and pie charts are used with qualitative data. In Excel, one column should show the categories, while the adjacent column should show the counts. Example: Top Ten Countries with Highest Incarceration Rates United States Russia Rwanda Cuba Belize Georgia Bahamas Belarus Kazakhstan French Guiana Per 100,000 753 629 593 531 476 423 407 385 382 365 To make a bar graph, highlight the cells shown in gray, select the insert drop down menu then choose chart. The dialogue box (Chart Wizard Step 1 of 4 - Chart Type) will show you column charts. The one that is already highlighted is the one you want. Click next. The dialogue box (Chart Wizard Step 2 of 4 – Chart Source Data) will show you a preview of the graph. It should look acceptable. Click next. The dialogue box (Chart Wizard Step 3 of 4 - Chart Options) will allow you to enter titles. Do this. Make sure your spelling is correct. Include units where appropriate. The dialogue box (Chart Wizard Step 4 of 4 - Chart Location) gives you the option of putting the chart on the spreadsheet or creating a new sheet with the chart. The default is to put it on the spreadsheet. Click Finish. Page 2 of 22 Pie Charts for Excel 2003 Example Offense Violent Property Drug Public-order Other Number in 2010 14830 11264 97472 65873 1203 To make a pie graph, highlight the cells shown in gray, select the insert drop down menu then choose chart. The dialogue box (Chart Wizard Step 1 of 4 - Chart Type) will show you options for chart types. Select Pie. The one that is already highlighted is the one you want. Click next. The dialogue box (Chart Wizard Step 2 of 4 – Chart Source Data) will show you a preview of the graph. It should look acceptable. Click next. The dialogue box (Chart Wizard Step 3 of 4 - Chart Options) will allow you to enter titles. Do this. Make sure your spelling is correct. Include units where appropriate. The dialogue box (Chart Wizard Step 4 of 4 - Chart Location) gives you the option of putting the chart on the spreadsheet or creating a new sheet with the chart. The default is to put it on the spreadsheet. Click Finish. Number of Sentenced Prisoners in Federal Prison by Most Serious Offense, 2010 Other 1% Violent 8%Property 6% Public-order 35% Drug 50% Percentages, values or a new placement of titles can be added by double clicking on the graph, selecting the data labels tab, then making your desired selection. Page 3 of 22 Histograms for Excel 2003 To make a histogram for one population, the sequence of steps is to find the highest and lowest data values, make a frequency distribution, then make a bar graph of the frequencies. Low and High To find the lowest value in the data, type the formula =min(data array). (For example =min(A4:A35). To find the highest value in the data, type the formula = max(data array). Frequency Distribution. Create lower and upper boundaries. If your classes are [0,2000), [2000,4000), [4000,6000), etc then create your classes as follows: The upper boundary must be slightly less than the next lower boundary because of the way in which Excel will count the data values. Lower Upper Frequency 0 1,999.9 2,000 3,999.9 If you highlight the top two cells in each column, let go of the mouse button and move the cursor to the bottom right corner of the highlighted cells, the cursor will change to the auto fill symbol. By clicking and dragging down, Excel will complete the classes, using the same pattern as you’ve established. Frequencies This is tricky, so be careful. Highlight the empty cells in the frequency column next to the upper boundaries. Move the cursor out of the way without clicking. Type the formula = frequency (data array, bin array). The data array are the cells with the data, the bin array are the cells with the upper boundary. Hold the control and shift keys down while you press enter. Graph To make the graph, highlight the frequencies you just created. Select the insert drop down menu then choose chart. The dialogue box (Chart Wizard Step 1 of 4 - Chart Type) will show you column charts. The one that is already highlighted is the one you want. Click next. The dialogue box (Chart Wizard Step 2 of 4 – Chart Source Data) will show you a preview of the graph. Notice the numbers under the bars are 1,2,3… instead of the numbers that are appropriate for your data. Select the series tab. At the bottom is a box Page 4 of 22 that is labeled Category (x) axis labels: . Click in that box then highlight the lower boundaries of your frequency distribution. Click Next The dialogue box (Chart Wizard Step 3 of 4 - Chart Options) will allow you to enter titles. Do this. Make sure your spelling is correct. Include units where appropriate. The dialogue box (Chart Wizard Step 4 of 4 - Chart Location) gives you the option of putting the chart on the spreadsheet or creating a new sheet with the chart. The default is to put it on the spreadsheet. Click Finish. To make the bars touch each other, double click on a bar to open the Format Data Series dialogue box. Select the Options tab, then change Gap Width to 0. To move the numbers to the left so they appear to be between bars, double click on one of the x axis numbers to open the Format Axis dialogue box. Select the alignment tab then tip the numbers to a 45° angle. This will cause them to shift slightly to the left. This is pretty lame, but the best this version of Excel can do. Frequency 30 Greenhouse Gas Emissions From Randomly Selected US Power Plants, 2010 25 20 15 10 5 0 0 0 00 2, 0 00 4, 0 00 6, 0 00 8, 00 ,0 0 1 00 ,0 2 1 GHG (1000 Metric Tonnes CO2 equivalent) Page 5 of 22 00 ,0 4 1 Double Bar Histograms for Excel 2003 To make a double bar histogram for two populations, the sequence of steps is to find the highest and lowest data of all the values, make a frequency distribution with two columns for frequencies, then make a bar graph of the frequencies. 1 2 3 4 5 6 A B Santa Fe Scandinavia 146 105 90 55 76 75 130 30 132 119 Low and High To find the lowest value that is in all columns of data, type the formula =min(data array). For example =min(A2:B6). To find the highest value that is in all columns data, type the formula = max(data array). Frequency Distribution. Create lower and upper boundaries that are appropriate for both columns at the same time. If your classes are [20,40), [40,60), [60,80), [80,100) etc. then create your classes as follows: Lower 20 40 60 80 Upper 39.9 59.9 79.9 99.9 Santa Fe Scandinavia If you highlight the top two cells in each column, let go of the mouse button and move the cursor to the bottom right corner of the highlighted cells, the cursor will change to the auto fill symbol. By clicking and dragging down, Excel will complete the classes, using the same pattern as you’ve established. Frequencies This is tricky, so be careful. Do one frequency column at a time. Highlight the empty cells in the frequency column next to the upper boundaries. Move the cursor out of the way without clicking. Type the formula = frequency (data array, bin array). The data array are the cells with the data, the bin array are the cells with the upper boundary. The data for Santa Fe is in the Santa Fe column only. The data for Scandinavia is in the Scandinavia column only. Hold the control and shift keys down while you press enter. Page 6 of 22 Graph To make the graph, highlight both the Santa Fe frequency column and Scandinavia frequency column, including the heading. Select the insert drop down menu then choose chart. The dialogue box (Chart Wizard Step 1 of 4 - Chart Type) will show you column charts. The one that is already highlighted is the one you want. Click next. The dialogue box (Chart Wizard Step 2 of 4 – Chart Source Data) will show you a preview of the graph. Notice the numbers under the bars are 1,2,3… instead of the numbers that are appropriate for your data. Select the series tab. At the bottom is a box that is labeled Category (x) axis labels: . Click in that box then highlight the lower boundaries of your frequency distribution. Click Next The dialogue box (Chart Wizard Step 3 of 4 - Chart Options) will allow you to enter titles. Do this. Make sure your spelling is correct. Include units where appropriate. The dialogue box (Chart Wizard Step 4 of 4 - Chart Location) gives you the option of putting the chart on the spreadsheet or creating a new sheet with the chart. The default is to put it on the spreadsheet. Click Finish. To make the bars touch each other, double click on a bar to open the Format Data Series dialogue box. Select the Options tab, then change Gap Width to 0. To move the numbers to the left so they appear to be between bars, double click on one of the x axis numbers to open the Format Axis dialogue box. Select the alignment tab then tip the numbers to a 45° angle. This will cause them to shift slightly to the left. This is pretty lame, but the best this version of Excel can do. Page 7 of 22 Scatter Plots in Excel 2003 A scatter plot is used to compare two quantitative variables. Even if there appears to be a relationship between the two variables, we can not say that one caused the other (correlation does not imply causation). Graph To make the graph, select both columns of data by highlighting the data. Select the insert drop down menu then choose chart. The dialogue box (Chart Wizard Step 1 of 4 - Chart Type) will show you column charts. Select XY(Scatter). Click next. The dialogue box (Chart Wizard Step 2 of 4 – Chart Source Data) will show you a preview of the graph. Click Next The dialogue box (Chart Wizard Step 3 of 4 - Chart Options) will allow you to enter titles. Do this. Make sure your spelling is correct. Include units where appropriate. The dialogue box (Chart Wizard Step 4 of 4 - Chart Location) gives you the option of putting the chart on the spreadsheet or creating a new sheet with the chart. The default is to put it on the spreadsheet. Click Finish. To add a trendline and regression equation, click once on any point on the graph. Under the Chart menu at the top, select Add Trendline. Linear should already be selected. Click on the options tab then click in the boxes for “Display equation on Chart” and “Display R-squared Value on Chart”. Comparison of Flash Card Average and Exam Grade Average for Math 98 y = 4.4455x + 39.022 2 R = 0.3089 Exam Average (Percent) 120.0 100.0 80.0 60.0 40.0 20.0 0.0 0.0 2.0 4.0 6.0 8.0 10.0 12.0 Flash Card Average (in 30 seconds) Page 8 of 22 14.0 Time Series in Excel 2003 A time series graph is used to see how the dependent variable(s) change over time. While the process is similar to making a scatter plot, time series data often has a high degree of autocorrelation, which means that the data are not independent. Consequently, it may not be appropriate to fit it with a regression line. Graph To make the graph, highlight the data, including the year. Select the insert drop down menu then choose chart. The dialogue box (Chart Wizard Step 1 of 4 - Chart Type) will show you column charts. Select XY(Scatter). Click next. The dialogue box (Chart Wizard Step 2 of 4 – Chart Source Data) will show you a preview of the graph. Click Next The dialogue box (Chart Wizard Step 3 of 4 - Chart Options) will allow you to enter titles. Do this. Make sure your spelling is correct. Include units where appropriate. The dialogue box (Chart Wizard Step 4 of 4 - Chart Location) gives you the option of putting the chart on the spreadsheet or creating a new sheet with the chart. The default is to put it on the spreadsheet. Click Finish. US Gross Public Federal Debt 18000 Gross Public Debt (billions) 16000 14000 12000 10000 8000 6000 4000 2000 0 1880 1900 1920 1940 1960 1980 Year Page 9 of 22 2000 2020 Bar Graphs and Pie Charts 2007 Bar graphs and pie charts are used with qualitative data. In Excel, one column should show the categories, while the adjacent column should show the counts. Example: Top Ten Countries with Highest Incarceration Rates United States Russia Rwanda Cuba Belize Georgia Bahamas Belarus Kazakhstan French Guiana Per 100,000 753 629 593 531 476 423 407 385 382 365 To make a bar graph, highlight the cells shown in gray, select the insert drop down menu then select Column graphs from the chart portion of the tool bar. Select the first column graph shown. That will produce a graph without titles. When you click once on the graph, your tool bars at the top should change. You should see Chart Tools at the top of the screen with three options, Design, Layout and Format. Select the Design menu, then under Chart Layouts, select Layout 9. Click on each of the three titles to edit. Page 10 of 22 Pie Charts for Excel 2007 or 2010 Example Offense Violent Property Drug Public-order Other Number in 2010 14830 11264 97472 65873 1203 To make a pie graph, highlight the cells shown in gray, select the insert drop down menu then select Pie graphs from the chart portion of the tool bar. Select the first pie graph shown. That will produce a graph without titles. Page 11 of 22 When you click once on the graph, your tool bars at the top should change. You should see Chart Tools at the top of the screen with three options, Design, Layout and Format. Select the Design menu, then under Chart Layouts, select Layout1, which will put the description and percent in, or next to, the portion of the pie chart that it represents. Click on the title to edit. To add the number of numbers and percent in each slice, right click on the pie, select format data labels, then check the desired options. Page 12 of 22 Histogram for Excel 2007 To make a histogram for one population, the sequence of steps is to find the highest and lowest data values, make a frequency distribution, then make a bar graph of the frequencies. Low and High To find the lowest value in the data, type the formula =min(data array). (For example =min(A4:A35). To find the highest value in the data, type the formula = max(data array). Frequency Distribution. Create lower and upper boundaries. If your classes are [0,2000), [2000,4000), [4000,6000), etc then create your classes as follows: The upper boundary must be slightly less than the next lower boundary because of the way in which Excel will count the data values. Lower Upper Frequency 0 1,999.9 2,000 3,999.9 If you highlight the top two cells in each column, let go of the mouse button and move the cursor to the bottom right corner of the highlighted cells, the cursor will change to the auto fill symbol. By clicking and dragging down, Excel will complete the classes, using the same pattern as you’ve established. Frequencies This is tricky, so be careful. Highlight the empty cells in the frequency column next to the upper boundaries. Move the cursor out of the way without clicking. Type the formula = frequency (data array, bin array). The data array are the cells with the data, the bin array are the cells with the upper boundary. Hold the control and shift keys down while you press enter. Graph To make the graph, highlight the frequencies you just created, select the insert drop down menu then select Column graphs from the chart portion of the tool bar. Select the first column graph shown. That will produce a graph without titles. Page 13 of 22 When you click once on the graph, your tool bars at the top should change. You should see Chart Tools at the top of the screen with three options, Design, Layout and Format. Select the Design menu, then under Chart Layouts, select Layout 8. Click on each of the three titles to edit. The y axis title can be called “frequency” or “number of observations”. To make the x axis scale appropriate for the data, right click on any of the numbers on the x axis, then select select data. In the dialogue box, under the words Horizontal (Category) Axis Labels, click on the edit button. In the Axis Labels dialogue box, the cursor should be in the space marked Axis label range. Highlight the lower boundaries of your frequency distribution. Then click ok. Then click ok again. To make these numbers shift to the left, click on one of them, select the Home menu item at the top of the computer screen then click the left justify icon. To put a border around the columns, right click on a bar then select Format Data Series, then select Border Color to add a border around the bars. Page 14 of 22 Page 15 of 22 Double Bar Histograms for Excel 2007 To make a double bar histogram for two populations, the sequence of steps is to find the highest and lowest data of all the values, make a frequency distribution with two columns for frequencies, then make a bar graph of the frequencies. 1 2 3 4 5 6 A B Santa Fe Scandinavia 146 105 90 55 76 75 130 30 132 119 Low and High To find the lowest value that is in all columns of data, type the formula =min(data array). For example =min(A2:B6). To find the highest value that is in all columns data, type the formula = max(data array). Frequency Distribution. Create lower and upper boundaries that are appropriate for both columns at the same time. If your classes are [20,40), [40,60), [60,80), [80,100) etc. then create your classes as follows: Lower 20 40 60 80 Upper 39.9 59.9 79.9 99.9 Santa Fe Scandinavia If you highlight the top two cells in each column, let go of the mouse button and move the cursor to the bottom right corner of the highlighted cells, the cursor will change to the auto fill symbol. By clicking and dragging down, Excel will complete the classes, using the same pattern as you’ve established. Frequencies This is tricky, so be careful. Do one frequency column at a time. Highlight the empty cells in the frequency column next to the upper boundaries. Move the cursor out of the way without clicking. Type the formula = frequency (data array, bin array). The data array are the cells with the data, the bin array are the cells with the upper boundary. The data for Santa Fe is in the Santa Fe column only. The data for Scandinavia is in the Scandinavia column only. Hold the control and shift keys down while you press enter. Page 16 of 22 Graph To make the graph, highlight both the Santa Fe frequency column and Scandinavia frequency column, including the heading, select the insert drop down menu then select Column graphs from the chart portion of the tool bar. Select the first column graph shown. That will produce a graph without titles. When you click once on the graph, your tool bars at the top should change. You should see Chart Tools at the top of the screen with three options, Design, Layout and Format. Select the Design menu, then under Chart Layouts, select Layout 8. Click on each of the three titles to edit. The y axis title can be called “frequency” or “number of observations”. To make the x axis scale appropriate for the data, right click on any of the numbers on the x axis, then select select data. In the dialogue box, under the words Horizontal (Category) Axis Labels, click on the edit button. In the Axis Labels dialogue box, the cursor should be in the space marked Axis label range. Highlight the lower boundaries of your frequency distribution. Then click ok. Then click ok again. To make these numbers shift to the left, click on one of them, select the Home menu item at the top of the computer screen then click the left justify icon. Page 17 of 22 Notice that this graph is missing the legend. To put in the legend, under Chart Tools, select Layout. Under Labels, select Legend and then pick the option you prefer, such as Legend on Bottom. Page 18 of 22 Scatter Plot in Excel 2007 Graph To make the graph, highlight both data columns, but don’t including the heading. Select the insert drop down menu then select Scatter graphs from the chart portion of the tool bar. Select the first Scatter graph shown. That will produce a graph without titles. When you click once on the graph, your tool bars at the top should change. You should see Chart Tools at the top of the screen with three options, Design, Layout and Format. Select the Design menu, then under Chart Layouts, select Layout 1 to put in titles but not to put in the regression line. Click on each of the three titles to edit. Page 19 of 22 Select Layout 9 to include the regression line, equation and r2 value. To find the p-value to determine if there is significant correlation, you may need to install the Data Analysis Tool Pack. Click on the Windows Button in the top left corner of the screen. (On 2010 select the file tab) Select Excel Options at the bottom of the box (On 2010, select Options) On the left side, select Add-Ins At the bottom, next to where it says Excel Add-ins, click on Go Check the first box, which says Analysis ToolPak. On Pierce College Computers, this will result in a downloading of this add-in. On your home computer, you will need your Excel disk at this time. Page 20 of 22 To do the actual Analysis: Select the data tab, Select the data analysis option (near the top right side of the screen) Select Regression Fill in the spaces for the y and x data ranges. Click ok. A new spreadsheet will be created. An example of the summary output is shown below. SUMMARY OUTPUT Regression Statistics Multiple R R Square Adjusted R Square Standard Error Observations 0.555766 0.308876 0.283278 11.40744 29 This number is the absolute value of the correlation coefficient You will need to find the sign This is the same r2 value as will appear on the graph. ANOVA df Regression Residual Total Intercept Flash Card Average (30 sec) MS 1570.246 130.1298 F 12.06677 Significance F 0.001748 This is the p-value 1 27 28 SS 1570.246 3513.504 5083.75 Coefficients 39.02162 Standard Error 11.0994 t Stat 3.515651 P-value 0.001569 Lower 95% 16.24753 Upper 95% 61.79571 Lower 95.0% 16.24753 Up 95 61.7 4.445548 1.279764 3.473726 0.001748 1.81969 7.071406 1.81969 7.07 The hypotheses being tested are: H0: ρ = 0 (no correlation) H1: ρ ≠ 0 (significant correlation) Page 21 of 22 Time Series in Excel 2007 and 2010 A time series graph is used to see how the dependent variable(s) change over time. While the process is similar to making a scatter plot, time series data often has a high degree of autocorrelation, which means that the data are not independent. Consequently, it may not be appropriate to fit it with a regression line. Highlight the columns with the data you want to graph (Columns A and B). The column with time (years) should always be the left most column that is highlighted. Select the Insert ribbon, then choose Scatter. Modify the graph using design layout 1 so you can add the titles. Page 22 of 22