How to Make a Histogram in Excel (Step-by-Step Guide) - KING OF EXCEL

Wednesday, January 22, 2020

How to Make a Histogram in Excel (Step-by-Step Guide)

How to Make a Histogram in Excel (Step-by-Step Guide)

Histogram in Excel - frequency table
A simple example of a histogram is the distribution of marks scored in a subject. You can easily create a histogram and see how many students scored less than 35, how many were between 35-50, how many between 50-60 and so on.

There are different ways you can create a histogram in Excel:
  • If you’re using Excel 2016, there is an in-built histogram chart option that you can use.
  • If you’re using Excel 2013, 2010 or prior versions (and even in Excel 2016), you can create a histogram using Data Analysis Toolpack or by using the FREQUENCY function (covered later in this tutorial)
Let’s see how to make a Histogram in Excel.
This Tutorial Covers:

Creating a Histogram in Excel 2016

Excel 2016 got a new addition in the charts section where a histogram chart was added as an inbuilt chart.
In case you’re using Excel 2013 or prior versions, check out the next two sections (on creating histograms using Data Analysis Toopack or Frequency formula).
Suppose you have a dataset as shown below. It has the marks (out of 100) of 40 students in a subject.
Students Marks to create histogram in Excel 2016
Here are the steps to create a Histogram chart in Excel 2016:
  1. Select the entire dataset.
  2. Click the Insert tab.Insert Tab in the Excel Ribbon
  3. In the Charts group, click on the ‘Insert Static Chart’ option.Insert Static Chart Option in the Ribbon
  4. In the HIstogram group, click on the Histogram chart icon.Histogram Chart Option in the Ribbon
The above steps would insert a histogram chart based on your data set (as shown below).
Resulting Histogram Chart in Excel 2016
Now you can customize this chart by right-clicking on the vertical axis and selecting Format Axis.
Format Axis for Histogram Bin Options
This will open a pane on the right with all the relevant axis options.
Bin Options in the Histogram Chart in Excel 2016
Here are some of the things you can do to customize this histogram chart:
  1. By Category: This option is used when you have text categories. This could be useful when you have repetitions in categories and you want to know the sum or count of the categories. For example, if you have sales data for items such as Printer, Laptop, Mouse, and Scanner, and you want to know the total sales of each of these items, you can use the By Category option. It isn’t helpful in our example as all our categories are different (Student 1, Student 2, Student3, and so on.)
  2. Automatic: This option automatically decides what bins to create in the Histogram. For example, in our chart, it decided that there should be four bins. You can change this by using the ‘Bin Width/Number of Bins’ options (covered below).
  3. Bin Width: Here you can define how big the bin should be. If I enter 20 here, it will create bins such as 36-56, 56-76, 76-96, 96-116.Specifying Bin width in histogram chart
  4. Number of Bins: Here you can specify how many bins you want. It will automatically create a chart with that many bins. For example, if I specify 7 here, it will create a chart as shown below. At a given point, you can either specify Bin Width or Number of Bins (not both).Specifying Number of Bins in histogram chart
  5. Overflow Bin: Use this bin if you want all the values above a certain value clubbed together in the Histogram chart. For example, if I want to know the number of students that have scored more than 75, I can enter 75 as the Overflow Bin value. It will show me something as shown below.Overflow Bin Value in Histogram Excel 2016
  6. Underflow Bin: Similar to Overflow Bin, if I want to know the number of students that have scored less than 40, I can enter 4o as the value and show a chart as shown below.Underflow Bin Value in Histogram Excel 2016
Once you have specified all the settings and have the histogram chart you want, you can further customize it (changing the title, removing gridlines, changing colors, etc.)

Creating a Histogram Using Data Analysis Tool pack

The method covered in this section will also work for all the versions of Excel (including 2016). However, if you’re using Excel 2016, I recommend you use the inbuilt histogram chart (as covered below)
To create a histogram using Data Analysis tool pack, you first need to install the Analysis Toolpak add-in.
This add-in enables you to quickly create the histogram by taking the data and data range (bins) as inputs.

Installing the Data Analysis Tool Pack

To install the Data Analysis Toolpak add-in:
  • Click the File tab and then select ‘Options’.
Histogram in Excel - Options
  • In the Excel Options dialog box, select Add-ins in the navigation pane.
Histogram in Excel - Addins
  • In the Manage drop-down, select Excel Add-ins and click Go.
Histogram in Excel - Excel Addins
  • In the Add-ins dialog box, select Analysis Toolpak and click OK.
Histogram in Excel - Addins dialog box
This would install the Analysis Toolpak and you can access it in the Data tab in the Analysis group.
Histogram in Excel - Data Analysis Tab

Creating a Histogram using Data Analysis Toolpak

Once you have the Analysis Toolpak enabled, you can use it to create a histogram in Excel.
Suppose you have a dataset as shown below. It has the marks (out of 100) of 40 students in a subject.
Create Histogram in Excel - Dataset
To create a histogram using this data, we need to create the data intervals in which we want to find the data frequency. These are called bins.
With the above dataset, the bins would be the marks intervals.
You need to specify these bins separately in an additional column as shown below:
Create Histogram in Excel - bins
Now that we have all the data in place, let’s see how to create a histogram using this data:
  • Click the Data tab.
  • In the Analysis group, click on Data Analysis.
Histogram in Excel - Data Analysis Tab
  • In the ‘Data Analysis’ dialog box, select Histogram from the list.
Histogram in Excel - Data Analysis Dialog Box
  • Click OK.
  • In the Histogram dialog box:
    • Select the Input Range (all the marks in our example)
    • Select the Bin Range (cells D2:D7)
    • Leave the Labels checkbox unchecked (you need to check it if you included labels in the data selection).
    • Specify the Output Range if you want to get the Histogram in the same worksheet.  Else, choose New Worksheet/Workbook option to get it in a separate worksheet/workbook.
    • Select Chart Output.
Histogram in Excel - Histgram dialog box
  • Click OK.
This would insert the frequency distribution table and the chart in the specified location.
Histogram in Excel - frequency table
Now there are some things you need to know about the histogram created using the Analysis Toolpak:
  • The first bin includes all the values below it. In this case, 35 shows 3 values indicating that there are three students who scored less than 35.
  • The last specified bin is 90, however, Excel automatically adds another bin – More. This bin would include any data point which lies after the last specified bin. In this example, it means that there are 2 students who have scored more than 90.
    • Note that even if I add the last bin as 100, this additional bin would still be created.
  • This creates a static histogram chart. Since Excel creates and pastes the frequency distribution as values, the chart would not update when you change the underlying data. To refresh it, you’ll have to create the histogram again.
    • The default chart is not always in the best format. You can change the formatting like any other regular chart.
  • Once created, you can not use Control + Z to revert it. You’ll have to manually delete the table and the chart.
If you create a histogram without specifying the bins (i.e., you leave the Bin Range empty), it would still create the histogram. It would automatically create six equally spaced bins and used this data to create the histogram.

Creating a Histogram using FREQUENCY Function

If you want to create a histogram that is dynamic (i.e., updates when you change the data), you need to resort to formulas.
In this section, you’ll learn how to use the FREQUENCY function to create a dynamic histogram in Excel.
Again, taking the student’s marks data, you need to create the data intervals (bins) in which you want to show the frequency.
Create Histogram in Excel - Bins frequency
Here is the function that will calculate the frequency for each interval:
=FREQUENCY(B2:B41,D2:D8)
Since this is an array formula, you need to use Control + Shift + Enter, instead of just Enter.
Here are the steps to make sure you get the correct result:
  • Select all cells adjacent to the bins. In this case, these are E2:E8.
  • Press F2 to get into the edit mode for cell E2.
  • Enter the frequency formula: =FREQUENCY(B2:B41,D2:D8)
  • Hit Control + Shift + Enter.
Histogram in Excel - frequency function
With the result that you get, you can now create a histogram (which is nothing but a simple column chart).
Histogram in Excel - chart
Here are some important things you need to know when using the FREQUENCY function:
  • The result is an array and you can not delete a part of the array. If you need to, delete all the cells that have the frequency function.
  • When a bin is 35, the frequency function would return a result that includes 35. So 35 means score up to 35, and 50 would mean score more than 35 and up to 50.
Also, let’s say you want to have the specified data intervals till 80, and you want to group all the result above 80 together, you can do that using the FREQUENCY function. In that case, select one more cell than the number of bins. For example, if you have 5 bins, then select 6 cells as shown below:
Histogram in Excel - select one more than bin
FREQUENCY function would automatically calculate all the values above 80 and return the count.
Histogram in Excel - result when one more bin is selected
#evba #etipfree #kingexcel
📤You download App EVBA.info installed directly on the latest phone here : https://www.evba.info/p/app-evbainfo-setting-for-your-phone.html?m=1

Popular Posts