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 in Excel 2003 Bar Graphs and Pie Charts 2007 Histogram for Excel 2007 Double Bar Histograms for Excel 2007 Scatter Plot in Excel 2007 1 2 3 4 6 8 9 12 15 18 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 20 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: Question: Does it appear that over half the people in Seattle live on land with less than 5 people per acre? Density of existing neighborhoods 2000 Seattle 0-1 people per Acre 113 1-5 people per Acre 214 5-12 people per Acre 135 12 or more people per Acre 101 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. Distribution of Population Densities in Seattle, 2000 Number of People 250 200 150 100 50 0-1 people per Acre 1-5 people per Acre 5-12 people per 12 or more Acre people per Acre Population Density Page 2 of 20 Pie Charts for Excel 2003 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. Distribution of Seattle Population Densities, 2000 18% 20% 0-1 people per Acre 1-5 people per Acre 5-12 people per Acre 24% 12 or more people per Acre 38% 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 20 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,0.2), [0.2,0.4), [0.4,0.5), [0.6,0.8) 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 0 0.2 0.4 0.6 Upper 0.19 0.39 0.59 0.79 Frequency 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. Page 4 of 20 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 5 of 20 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 20 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 20 Scatter Plot in Excel 2003 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. 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”. Page 8 of 20 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: Question: Does it appear that over half the people in Seattle live on land with less than 5 people per acre? Density of existing neighborhoods 2000 Seattle 0-1 people per Acre 113 1-5 people per Acre 214 5-12 people per Acre 135 12 or more people per Acre 101 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 9 of 20 Distribution of Population Densities in Seattle, 2000 Number of People 250 200 150 100 50 0-1 people per Acre 1-5 people per Acre 5-12 people per 12 or more Acre people per Acre Population Density 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. 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. Page 10 of 20 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 11 of 20 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,0.2), [0.2,0.4), [0.4,0.5), [0.6,0.8) 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 0 0.2 0.4 0.6 Upper 0.19 0.39 0.59 0.79 Frequency 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 12 of 20 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 13 of 20 Page 14 of 20 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 15 of 20 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 16 of 20 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 17 of 20 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 18 of 20 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. Select Excel Options at the bottom of the box 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 19 of 20 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 This number is the absolute value of the correlation coefficient 0.968963 You will need to find the sign 0.938889 This is the same r2 value as will appear on the graph. 0.918519 0.60553 5 ANOVA df Regression Residual Total Intercept X Variable 1 SS 1 3 4 MS F Significance F 16.9 16.9 46.09091 0.006533 This is the p-value 1.1 0.366667 18 Coefficients Standard Error t Stat P-value Lower 95% 10.2 0.812404 12.55533 0.001089 7.614568 -1.3 0.191485 -6.78903 0.006533 -1.90939 The hypotheses being tested are: H0: ρ = 0 (no correlation) H1: ρ ≠ 0 (significant correlation) Page 20 of 20 Upper 95% Lower 95.0% U 12.78543 7.614568 -0.69061 -1.90939