Tuesday, June 05, 2007

How to construct a histogram in Excel (without Data Analysis Toolpak)




This example uses the following simple data set (quiz scores for twenty students): 5, 7, 8, 3, 7, 7, 1, 9, 6, 8, 5, 6, 7, 8, 7, 9, 6, 8, 6, 6. To construct a histogram with five bars:
Type numbers in column A, starting at A1. Press ENTER after each number.
In column B, starting at B1 type 2, 4, 6, 8. Note that it is not necessary to write 0 or 10.
Because the histogram will have 5 separate bins, select 5 contiguous cells, for example c3:c7.
Click in the formula bar (the long white bar with the equals sign) and type =frequency(a1:a20, b1:b4). The first array contains the data; the second array contains the bin separators.
Press Control-Shift-Enter simultaneously. You will see an array of 5 numbers.
To draw the graph, you can use the chart wizard: Highlight the number in column C. Click on the chart icon at the top of the page. Choose columns. Click on "next". A bar graph will appear in the window. To make the graph comprehensible to others, add some titles by clicking on "next". For titles, type "histogram of quiz scores". For category, type "quiz score". For value on the y axis, type "quiz score frequency". Click "finish".
The graph that you see now is technically a bar graph, NOT a histogram, because there are spaces between all the bars. Histograms should not have spaces between the bars unless there are categories that have no observations. To rectify this, double click on one of the bars. Another window will appear. Click on "options" and change the gap width to 0. Then click "OK". Now it’s a legitimate histogram.

No comments: