Create a histogram

How to Create a Histogram in Excel, Google Sheets, and Python

histogram displays the distribution of numerical data by grouping values into bins (intervals). Here’s how to create one in different tools:


1. In Microsoft Excel

Method 1: Using the Built-in Histogram Tool (Excel 2016 & later)

  1. Enter your data in a single column (e.g., A1:A50).

  2. Define your bins (intervals) in another column (e.g., B1:B6).

  3. Insert the Histogram:

    • Select your data.

    • Go to Insert → Charts → Histogram (under “Statistical Charts”).

  4. Customize bins:

    • Right-click the x-axis → Format Axis → Adjust bin width, number, or overflow/underflow settings.

Method 2: Using Data Analysis ToolPak (Older Excel Versions)

  1. Enable the ToolPak:

    • Go to File → Options → Add-ins → Select Analysis ToolPak → Click Go → Check Analysis ToolPak → OK.

  2. Create the Histogram:

    • Go to Data → Data Analysis → Histogram.

    • Select input range (your data) and bin range → Check Chart Output.


2. In Google Sheets

  1. Enter your data in a column (e.g., A1:A50).

  2. Insert a Chart:

    • Select your data → Insert → Chart.

  3. Change Chart Type to Histogram:

    • In the Chart Editor → Setup → Change chart type to Histogram.

  4. Adjust Bins:

    • Click the 3 dots (⋮) on the chart → Edit chart → Customize → Histogram → Adjust bucket size.


3. In Python (Using Matplotlib)

import matplotlib.pyplot as plt

# Sample data
data = [23, 45, 56, 78, 34, 67, 89, 12, 45, 67, 89, 23, 45, 67]

# Create histogram
plt.hist(data, bins=5, edgecolor=’black’) # Adjust ‘bins’ as needed
plt.title(“Histogram Example”)
plt.xlabel(“Value Ranges”)
plt.ylabel(“Frequency”)
plt.show()

Customizations:

  • bins=5 → Number of intervals.

  • color='blue' → Change bar color.

  • edgecolor='black' → Add borders to bars.


Which tool are you using?

  • For quick analysis → Excel/Google Sheets

  • For advanced statistics → Python (Matplotlib/Seaborn)

Leave a Reply 0

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