Grouped Data Calculator

Mean, median, mode, quartiles and standard deviation estimated from a grouped frequency table of classes, with class boundaries shown.

Write each line as lower limit, upper limit and frequency, e.g. “10-19, 6” or “10 19 6”. Classes in increasing order, up to 100. For negative limits write e.g. “-10 to -1, 4”.

Results

Mean (estimate)
24.1
Median (interpolated in class 21–30)
23
Mode (estimate in the modal class 11–20)
18
Standard deviation (sample, n − 1)
12.938
Variance (sample, n − 1)
167.39
Standard deviation (population, n)
12.808
First quartile Q1 (interpolated)
13.714
Third quartile Q3 (interpolated)
34.389
Interquartile range (Q3 − Q1)
20.675
Total frequency (n)
50
Σ f × midpoint
1,205
Working table
Class | boundaries | midpoint | f | cumulative f 1–10 | 0.5 to 10.5 | 5.5 | 8 | 8 11–20 | 10.5 to 20.5 | 15.5 | 14 | 22 21–30 | 20.5 to 30.5 | 25.5 | 12 | 34 31–40 | 30.5 to 40.5 | 35.5 | 9 | 43 41–50 | 40.5 to 50.5 | 45.5 | 7 | 50

How it’s calculated

When data come as a frequency table of classes (for example 11–20 minutes: 14 people), the individual values are unknown, so the mean, median, mode and standard deviation can only be estimated. The usual method treats every value in a class as sitting at the class midpoint for the mean and standard deviation, and spreads the values evenly across the class for the median and quartiles.

midpoint m = (lower limit + upper limit) / 2 mean = Σ f·m / n n = Σ f sample SD = √( Σ f·(m − mean)² / (n − 1) ) median = L + (n/2 − F) / f × w (median class: first class whose cumulative frequency reaches n/2) Q1 = L + (n/4 − F) / f × w Q3 = L + (3n/4 − F) / f × w mode = L + Δ1 / (Δ1 + Δ2) × w (modal class: highest frequency)

L is the lower class boundary of the class used, F the cumulative frequency before it, f its frequency and w its width. Δ1 and Δ2 are how much the modal class’s frequency exceeds the class before and after it. When classes have gaps, such as 1–10 and 11–20 for whole numbers, the boundary is halfway across the gap (10.5), so the class 11–20 runs from 10.5 to 20.5 and has width 10.

Example (University of Massachusetts lecture notes): travel times to work 1–10: 8, 11–20: 14, 21–30: 12, 31–40: 9, 41–50: 7, so n = 50. The cumulative frequencies are 8, 22, 34, 43, 50, so the median class is 21–30 (boundaries 20.5 to 30.5). Median = 20.5 + (25 − 22)/12 × 10 = 23. (The notes write L = 20.5 but then substitute 21.5, giving 24; 20.5 is correct.) Q1 = 10.5 + (12.5 − 8)/14 × 10 = 13.714, Q3 = 30.5 + (37.5 − 34)/9 × 10 = 34.389. The modal class is 11–20: mode = 10.5 + 6/(6 + 2) × 10 = 18 (the notes print 17.5, another arithmetic slip). With midpoints 5.5, 15.5, 25.5, 35.5 and 45.5, Σf·m = 1205, so the mean is 24.1. These are the default values.

Frequently asked questions

Why are the results only estimates?

A frequency table hides the actual values inside each class. The formulas assume values sit at the class midpoint (mean, standard deviation) or are spread evenly across the class (median, quartiles), so the answers are close to, but not exactly, what the raw data would give.

What are class boundaries?

They close the gaps between classes. For whole-number classes 1–10 and 11–20 the boundary is 10.5, so every possible value belongs to exactly one class. Interpolation uses boundaries and the class width measured between them.

Can I use classes like 0–10, 10–20?

Yes. When one class ends where the next begins, the boundaries are the limits themselves. Enter the classes in increasing order without overlaps.

What if two classes share the highest frequency?

Then there is no single modal class, and the calculator lists the classes instead of estimating one mode.

Embed this calculator

Add this free calculator to your own website. Copy the code below into your page’s HTML:

Need this calculator branded, changed or built around your own prices?See custom business solutions →

Sources

Formulas are taken from the free public references above. Results are provided “as is” for informational and educational purposes only. See our disclaimer.

Added · Last updated · How we check our calculators

Spotted a mistake or missing option? Report a problem· Suggest a calculator