Grouped Data Median and Mode Calculator
Find the median, mode, quartiles and interquartile range of grouped data from class intervals and frequencies, using the interpolation formulas with class boundaries and a cumulative frequency table.
How it works
Median = L + [(N/2 − F) ÷ f] × h · Mode = L + [(f₁ − f₀) ÷ ((f₁ − f₀) + (f₁ − f₂))] × h · Qk = L + [(k·N/4 − F) ÷ f] × h · L = lower boundary of the median/modal/quartile class, F = cumulative frequency before it, f (f₁) = its frequency, f₀ / f₂ = frequencies of the classes before / after, h = class width
When data come as a frequency table, the exact median and mode are lost, so they are estimated by assuming the values are spread evenly inside each class. The median class is the first one whose cumulative frequency reaches N/2; the median is found by linear interpolation inside it. The mode is placed inside the class with the highest frequency, pulled toward whichever neighbouring class is larger. Quartiles use the same interpolation at N/4 and 3N/4. If your classes have gaps (10–19, 20–29) the calculator works with the true class boundaries (9.5–19.5, 19.5–29.5).
Worked example
Classes 0–10, 10–20, 20–30, 30–40, 40–50 with frequencies 4, 8, 12, 9, 7 (N = 40): N/2 = 20 falls in 20–30 (cumulative 12 before it), so the median = 20 + (20 − 12) ÷ 12 × 10 = 26.667. The modal class is also 20–30: mode = 20 + (12 − 8) ÷ ((12 − 8) + (12 − 9)) × 10 = 25.714. Q1 = 10 + (10 − 4) ÷ 8 × 10 = 17.5 and Q3 = 30 + (30 − 24) ÷ 9 × 10 = 36.667, so the IQR is 19.167.
Sources: Grouped data — Wikipedia · Median — Wikipedia
Frequently asked questions
How do I find the median class?
Compute the cumulative frequencies and N/2. The median class is the first class whose cumulative frequency is greater than or equal to N/2. In the example N/2 = 20 and the cumulative frequencies are 4, 12, 24…, so the median class is the third one (20–30).
What do I do if the classes are 10–19, 20–29…?
Use class boundaries halfway between the limits: 9.5–19.5, 19.5–29.5, and so on, so that the width h is 10 and there are no gaps. The calculator does this automatically when all gaps are equal.
What if two classes have the same highest frequency?
The distribution is bimodal (or multimodal) and the grouped-mode formula gives one estimate per modal class. The calculator reports the first and flags the situation; in a report you would usually state both.
Why do mean, median and mode differ?
They coincide only for symmetric distributions. When the mean is above the median and mode, the data are skewed to the right (a long tail of high values); when it is below, skewed to the left. An empirical rule of thumb is mean − mode ≈ 3 × (mean − median).
Related calculators
Grouped-data statistics are estimates based on assuming values are spread evenly within each class.