How To Create A Histogram in Excel
How To Create A Histogram in Excel
vertex42.com/ExcelArticles/mc/Histogram.html
By Jon Wittwer
Advertisement
The last step is to analyze the results to figure out how much the profit might be expected to vary based
on our uncertainty in the values used as inputs for our model. We will start off by creating a histogram in
Excel. The image below shows the end result. Keep reading below to learn how to make the histogram.
Figure 1: A Histogram in Excel for the response variable Profit, created using a Bar Chart.
(From a Monte Carlo simulation using n = 5000 points and 40 bins).
The histogram tells a good story, but in many cases, we want to estimate the probability of being below
or above some value, or between a set of specification limits. To skip ahead to the next step in our
analysis, move on to Summary Statistics, or continue reading below to learn how to create the histogram
in Excel.
[ Summary Statistics ]
Update 7/2/15: A Histogram chart is one of the new built-in chart types in Excel 2016, finally! (Read about
it).
This is probably the easiest method, but you have to re-run the tool each to you
do a new simulation. AND, you still need to create an array of bins (which
will be discussed below).
This is the method used in the spreadsheet for the sales forecast example. One of the
reasons I like this method is that you can make the histogram dynamic, meaning that
every time you re-run the MC simulation, the chart will automatically update. This is how
you do it:
After you create the array of bins, you can go ahead and use the
Histogram tool, or you can
proceed with the next step.
FREQUENCY(data_array,bins_array)
If you want to compare your histogram with a probability distribution, you will need to scale the
histogram
so that the area under the curve is equal to 1 (one of the properties of probability distributions).
Histograms normally include the count of the data points that fall into each bin on the y-axis, but
after scaling, the y-axis will be the frequency (a not-so-easy-to-interpret number that in all practicality
you can just not worry about). The frequency doesn't represent probability!
a) K8 = (J8/$J$5)/($I$9-$I$8)
b) Copy cell K8 down to K48
To create the histogram, just create a bar chart using the Bins column for the Labels and the Count or
Scaled column as the Values. Tip: To reduce the spacing between the bars, right-click on the bars and
select "Format Data Series...". Then go to the Options tab and reduce the Gap. Figure 1 above was
created this way.
One of the problems with using bar charts and area charts is that the numbers on the x-axis are just
labels. This can make it very difficult to overlay data that uses a different number of points or to show the
proper scale when bins are not all the same size. However, you CAN use a scatter plot to create a
histogram. After creating a line using the Bins column for the X Values and Count or Scaled column for
the Y Values, add Y Error Bars to the line that extend down to the x-axis (by setting the Percentage to
100%). You can right-click on these error bars to change the line widths, color, etc.
Figure 4: Example Histogram Created Using a Scatter Plot and Error Bars.
Advertisement
[ Summary Statistics ]
REFERENCES:
NIST/SEMATECH e-Handbook of Statistical Methods, June 2004, "Histogram",
http://www.itl.nist.gov/div898/handbook/eda/section3/histogra.htm
Follow Us On ...
New Template !!
Monte Carlo Simulation Template
Popular Templates