Histogram Formula

What Is Histogram?

A histogram formula enables one to determine the inputs from the given dataset required to graphically show the numeric data distribution within the dataset. While we can apply the mathematical histogram formula in Excel, we can use inbuilt functions FREQUENCY and COUNTIFS to create the required histogram formulas.

Users can use the histogram formulas to categorize a massive dataset into regular intervals for displaying the complex and large volume of data in a simpler plot.

For example, the following table shows the age categories of people living in a gated community and the headcount in each age category (frequency).

Histogram Formula Definition Example - 1

The task is to determine the histogram area and visually represent the above data as a histogram.

Then, we can apply the class width expression and frequency density histogram formula based on the given source data.

Next, use the area of histogram formula in the required target cell. And then, create the required histogram using the class intervals and the frequency density data.

Histogram Formula Definition Example - 2

First, we introduce a new column, Class Width, which shows the difference between the maximum and minimum age for each specified age interval in column A. Next, we apply the frequency density histogram formula in column D cells to obtain each age interval’s frequency density based on the corresponding frequency and class width data.

And then, we choose cell D8 and enter the area of histogram formula, which gives the total headcount of the people in the gated community. The formula output will be the same as the sum of the frequencies in column B.

Finally, we can choose the cell ranges A1:A6 and D1:D6 and choose the 2-D Clustered Column chart in Excel from the Insert tab to create the required histogram for the given dataset.

Thus, the histogram visually shows the headcount frequency density across the different age intervals in the gated community.

Key Takeaways
  • The histogram formula helps calculate the values based on the source dataset, required to create a histogram for visually depicting the numeric distribution within the dataset.
  • Users can use the histogram formulato perform large-scale studies, such as demographic segmentation, to analyze customer identification in potential markets.
  • We can use the mathematical equivalent expression of the formula for the histogram in Excel. Alternatively, we can use the inbuilt functions FREQUENCY and COUNTIFS to develop histogram formulas.
  • We can use the histogram formulas instead of the Histogram option in the Data Analysis ToolPak in the Data tab.

Formula

The area of a histogram is the summation of the area of each bar in the plot. And the mathematical expression of the histogram formula to determine its area is as follows:

Histogram Formula Equation

Where,

  • Class Width: It is the difference between the maximum and minimum points of the specified interval.
  • Frequency Density: The ratio of the given frequency and the class width for the specific interval. In other words, it is the height of histogram formula for each bar in the plot.
  • i: Counter
  • n: The total number of intervals the source data is divided.

How To Use Histogram Formula?

Here is how we can create a histogram formula:

  1. Ensure the source dataset is complete and accurate to ensure we can determine the inputs required to plot a histogram chart.

  2. Next, calculate the total number of data points in the source dataset.

  3. Calculate the sample range.

    It is the difference between the maximum and minimum values in the given sample.

  4. Determine the total class intervals, in which we can divide the values specified in the source dataset.

    Typically, the total count of intervals is considered as 10. Otherwise, we can calculate the square root of the number of data points in the source dataset. And then, round off the result to the nearest whole number to obtain the total class intervals.

  5. Next, calculate the class width for each interval.

    It is the ratio of the sample range (determined in Step 3) and the total count of intervals (calculated in Step 4).

  6. Determine the frequency density for each interval.

    The height of histogram formula for each interval gives the ratio of the frequency and the class width of the corresponding interval.

  7. Next, choose the target cell and apply the histogram formula to obtain the area of the required histogram.

    And for that, we must multiply each interval’s frequency density and class width. And then add all the product values.

  8. Select the column range containing the interval details of the source dataset and the column containing the frequency density of each interval.

    And then, choose the Insert tab → Insert Column or Bar Chart category → 2-D Clustered Column chart to create a histogram.

  9. Right-click the data series in the chart area to access the Format Data Series option from the contextual menu.

    The Format Data Series pane opens, where we must set the Gap Width option in the Series Options tab as 0%.

    The above step will reduce the gap between the bars in the 2-D column chart, and the plot will appear as a histogram.

Furthermore, the histogram plot can be the following types, depending on how the frequencies specified in the source dataset are distributed.

  • Uniform – The number of classes will be less, with each class having the same number of elements. And the histogram might have more than one peak.
  • Symmetric – The histogram will be bell-shaped, with both sides of the plot identical in shape and size.
  • Bimodal – The distribution will have two peaks.

And once we create a histogram formula and plot the histogram chart, here is how to interpret the histogram data:

  • First, we must identify the independent and dependent variables. The parameter in the source data containing values such as the weight of a student is the independent variable. And the frequency or number of students with a specific weight will be the dependent variable.
  • Next, categorize the source data into groups based on their corresponding frequency in bins.
  • Plot a histogram chart using the class intervals and frequency density data. And then, we can analyze the data distribution across the different intervals to understand the trend similarities and differences.

Examples

Check out the following histogram formula examples to use the option effectively.

Example #1

The following table shows the athlete heights, segregated in different class intervals, along with the number of athletes in each class interval.

Histogram Formula in Excel - Example 1

The requirement is to develop the histogram formula to determine the area of the histogram and plot it for the given source data.

Then, the steps are as follows:

  • Step 1: Introduce columns C and D as the Class Width and Frequency Density columns.
Example 1 - Step 1
  • Step 2: Choose cell C2 and enter the formula to find the difference between the interval’s maximum and minimum values specified in cell A2.
Example 1 - Step 2a

Likewise, update the formulas in cells C3:C6 to determine each class interval’s width in each row.

Example 1 - Step 2b
  • Step 3: Choose cell D2, enter the formula to divide the frequency by the width of the specified interval, and press Enter.
Example 1 - Step 3a

Next, update the formula in the remaining cells D3:D6 using the Excel fill handle.

Example 1 - Step 3b
  • Step 4: Let us set cell D8 as the target cell to calculate and display the area of the histogram for the given data.
Example 1 - Step 4a

So, choose cell D8, enter the following formula, and press Enter.

=C2*D2+C3*D3+C4*D4+C5*D5+C6*D6

Example 1 - Step 4b

The area of the histogram is the same as the total frequency or number of athletes in column B cells B2:B6, 120.

  • Step 5: Choose cell A1. And then, with the mouse’s left button pressed, drag the mouse over the cell range A2:A6. Next, while pressing Ctrl and the mouse’s left key, drag the mouse over the cell range D1:D6 to select the two ranges.

And then, select Insert Insert Column or Bar Chart category.

Example 1 - Step 5a

Next, click the 2-D Clustered Column chart to select it.

Example 1 - Step 5b
Example 1 - Step 5c
  • Step 6: Right-click the data series in the chart area and select Format Data Series in the context menu to access the Format Data Series pane.
 Example 1 - Step 6a

And set Gap Width as 0% in the Series Options tab of the Format Data Series window.

Example 1 - Step 6b

Next, we can improve the histogram appearance. And for that, click the Fill & Line tab to set the Border as a Solid line in the required color.

 Example 1 - Step 6c

Close the Format Data Series window.

  • Step 7: Click the chart area to enable the Chart Elements option (‘+’ icon) and select the Axis Titles option.
Example 1 - Step 7a

And then, double-click the chart title and each axis title element in the chart area individually to update them according to our requirements.

Histogram Formula in Excel - Example 1 - Step 7b
Histogram Formula in Excel - Example 1 - Step 7c
Histogram Formula in Excel - Example 1 - Step 7d

Thus, the required histogram formulaand the plot will appear, as shown below.

Histogram Formula in Excel - Example 1 - Step 7e

So, now we can visually analyze the athletes’ distribution across different height classes and identify the height intervals containing the highest and lowest head counts.

Example #2

We shall now see how to achieve the histogram formula using the Excel FREQUENCY function and Excel COUNTIFS function.

Also, this method gives the same output as the Histogram option, in the Data Analysis ToolPak in Excel, for the specified source dataset and bins.

The following table lists students, and the project points they scored out of 100.

Histogram Formula in Excel - Example 2

The task is to categorize the project points into bins or contiguous non-overlapping intervals and create a histogram.

Then, we can use the appropriate histogram formula to determine the frequency or number of students with the project points in the same ranges (or bins). And then, use the 2-D Clustered Column chart to create the required histogram based on the intervals and frequencies data.

  • Step 1: We shall choose the cell range D1:F8 to list the bins and determine the frequency for the source dataset.

As the lowest and highest project points values are 35 and 100, we shall set the bins from 40 to 100.

Example 2 - Step 1
  • Step 2: Choose the range E2:E8 and enter the FREQUENCY().

=FREQUENCY(B2:B21,D2:D8)

Example 2 - Step 2a

And then, implement the function as we would execute array formulas in Excel, which is using the keys Ctrl + Shift + Enter.

Example 2 - Step 2b

The FREQUENCY() checks the number of values falling in each cited range or bin.

[ Alternatively, we can achieve the same output using the COUNTIFS().

And for that, choose cell F2, enter the COUNTIFS(), and press Enter.

=COUNTIFS($B$2:$B$21,”<=”&$D2)

Example 2 - Step 2c

Next, choose cell F3, enter the COUNTIFS(), and press Enter.

=COUNTIFS($B$2:$B$21,”>”&$D2,$B$2:$B$21,”<=”&$D3)

Example 2 - Step 2d

And then, using the fill handle, update the cell F3 formula in cells F4:F8.

Example 2 - Step 2e

The COUNTIFS() checks the number of values in the cited column B range falling within the specified bins.

Thus, the two formulas in columns E and F give the same output.]

The output shows the number of students in each bin or the project points range.

  • Step 3: We shall set the range H1:J8 to display the class intervals based on the bins and the determined frequency data for each bin.
Example 2 - Step 3
  • Step 4: Choose the ranges H1:H8 and J1:J8 (as explained earlier). And then, select Insert Insert Column or Bar Chart2-D Clustered Column chart type to insert the chosen plot type.
Example 2 - Step 4a
Example 2 - Step 4b
Example 2 - Step 4c

Finally, once we set the Gap Width as 0% and update the chart title and axis titles, as explained in the previous example, we obtain the following histogram plot.

Histogram Formula in Excel - Example 2 - Step 4d

Relevance And Uses

Let us see the relevance and uses of the histogram formula:

  • The formula enables us to create a histogram to represent complex data in a simplified manner.
  • Once we obtain the histogram from the formula, we can calculate aspects such as the histogram mean, median and skewness. These factors help us analyze the source dataset better.
  • The histogram we achieve using the formula is useful in large-scale studies, such as census data and demographic analysis.

Important Things To Note

  • When using the histogram formula for a massive dataset, ensure the source dataset includes at least 50 consecutive data points. And in the case of smaller samples, the source dataset must have at least 20 data values.
  • Ensure the source dataset contains numbers as the data points required for the histogram formula. Otherwise, the formula output will be an incorrect or error value.
  • Ensure to execute the FREQUENCY() as an array formula. Otherwise, the function output will be incorrect.

Frequently Asked Questions (FAQs)

1. How do I change the value of a histogram formula in Excel?

You can change the value of a histogram formula in Excel by changing the frequencies in the specified class intervals when using the mathematical equivalent formula for the histogram.

For example, the below image shows two datasets, each containing the weight intervals and frequencies or the number of people in each weight range.

Excel Histogram Formula - FAQ 1

The two datasets differ in the last class interval and their corresponding frequency.
Let us check how the changes in the values affect the area formula for the required histogram.

Step 1: Choose cell C2 and enter the formula to determine the specific class interval’s width.

FAQ 1 - Step 1a

Likewise, calculate the widths of the remaining class intervals.

FAQ 1 - Step 1b

Step 2: Choose cell D2, and enter the formula to determine the frequency density for the specific class interval, which is the corresponding frequency and class width ratio.

FAQ 1 - Step 2a

And then, drag the fill handle down to update the formula in the remaining cells.

FAQ 1 - Step 2b

Step 3: Select cell D8, enter the formula for the histogram area (shown in the Formula Bar), and press Enter.

Excel Histogram Formula - FAQ 1 - Step 3a

Similarly, iterate steps 1 to 3 for the second dataset to achieve the following output.

Excel Histogram Formula - FAQ 1 - Step 3b

The result shows that the histogram area values differ since the frequency for the last class interval in the second dataset differs from the first one.

Also, in the above scenario, the difference in the last class interval in the two datasets does not affect the respective histogram area values. The reason is that the histogram area formula depends on the frequency values.

2. How much data do you need for a histogram formula in Excel?

The amount of data you need for a histogram formula in Excel is as follows:

Massive Dataset
• At least 50 consecutive data points.
• At least 20 class intervals.

Smaller Sample Size
• At least 20 consecutive data points.
• At least 5 class intervals.

3. Can I use histogram formula in Excel on nominal data?

You cannot use histogram formula in Excel on nominal data. The reason is that nominal data gets measured across a scale with few probable values. And creating a histogram with minimal data is not advisable.

Download Template

This article must be helpful to understand the Histogram Formula, with its formula and examples. You can download the template here to use it instantly.

This has been a guide to What Is Histogram Formula. We explain the Histogram formula in Excel, its relevance, uses & how to use it with examples. You can learn more from the following articles –

Reader Interactions

Leave a Reply

Your email address will not be published. Required fields are marked *

CHATGPT & AI FOR MICROSOFT EXCEL COURSE - Today Only: 60% + 20% OFF! 🚀

X