The mean, median, and mode formulas calculate the three most common measures of central tendency in statistics. The mean is the arithmetic average of a dataset, the median is the middle value when the data is arranged in order, and the mode is the value that appears most frequently. Together, they describe where the centre of a dataset lies - though each defines "centre" differently.
Use the mean for symmetric data, the median for skewed data, and the mode for categorical data. The full breakdown follows.
The Mean, Median, and Mode Formulas at a Glance
Measure | Ungrouped Data Formula | Grouped Data Formula |
|---|---|---|
Mean | x̄ = Σx / n | x̄ = Σ(fᵢxᵢ) / Σfᵢ |
Median (n odd) | ((n+1)/2)ᵗʰ value | l + [(n/2 − cf) / f] × h |
Median (n even) | average of (n/2)ᵗʰ and ((n/2)+1)ᵗʰ values | l + [(n/2 − cf) / f] × h |
Mode | most frequently occurring value | l + [(f₁ − f₀) / (2f₁ − f₀ − f₂)] × h |
Variable definitions are listed under each formula below.
Mean Formula
The mean is the sum of all values divided by the number of values. It uses every data point and is the most widely used measure of central tendency.
Mean Formula for Ungrouped Data
x̄ = Σx / n
Variable | Meaning |
|---|---|
x̄ | Sample mean (read as "x-bar") |
Σx | Sum of all observations |
n | Number of observations |
Worked Example
Find the mean of {12, 15, 18, 20, 25}.
Σx = 12 + 15 + 18 + 20 + 25 = 90 n = 5 x̄ = 90 / 5 = 18
Answer: Mean = 18
In statistics, x̄ refers to the sample mean. The population mean is denoted by μ (the Greek letter mu). The formula is the same; the notation differs based on whether the data represents a sample or the full population.
Mean Formula for Grouped Data
x̄ = Σ(fᵢxᵢ) / Σfᵢ
Variable | Meaning |
|---|---|
fᵢ | Frequency of the iᵗʰ class |
xᵢ | Midpoint of the iᵗʰ class interval |
Σfᵢ | Total number of observations (n) |
Worked Example
Class Interval | Frequency (fᵢ) | Midpoint (xᵢ) | fᵢxᵢ |
|---|---|---|---|
0–10 | 5 | 5 | 25 |
10–20 | 8 | 15 | 120 |
20–30 | 15 | 25 | 375 |
30–40 | 9 | 35 | 315 |
40–50 | 3 | 45 | 135 |
Total | 40 | 970 |
x̄ = 970 / 40 = 24.25
Answer: Mean = 24.25
Two alternative methods — the assumed mean method and the step-deviation method — produce the same result with less arithmetic for large datasets.
Median Formula
The median is the middle value of a dataset arranged in ascending or descending order. It splits the data into two equal halves.
Median Formula for Ungrouped Data
For odd n: Median = ((n + 1) / 2)ᵗʰ value For even n: Median = average of (n/2)ᵗʰ and ((n/2) + 1)ᵗʰ values
Variable | Meaning |
|---|---|
n | Number of observations |
The data must be arranged in ascending order before applying the formula.
Worked Example 1 (odd n)
Find the median of {12, 15, 18, 20, 25}.
Already in ascending order. n = 5 (odd). Position = (5 + 1) / 2 = 3rd value. The 3rd value is 18.
Answer: Median = 18
Worked Example 2 (even n)
Find the median of {12, 15, 18, 20, 25, 28}.
Already in ascending order. n = 6 (even). Positions = (6/2)ᵗʰ = 3rd and ((6/2) + 1)ᵗʰ = 4th values. The 3rd value is 18; the 4th is 20. Median = (18 + 20) / 2 = 19
Answer: Median = 19
Median Formula for Grouped Data
Median = l + [(n/2 − cf) / f] × h
Variable | Meaning |
|---|---|
l | Lower boundary of the median class |
n | Total number of observations |
cf | Cumulative frequency of the class before the median class |
f | Frequency of the median class |
h | Class width |
The median class is the class whose cumulative frequency is the first to exceed n/2.
Worked Example
Using the same frequency table:
Class | Frequency | Cumulative Frequency |
|---|---|---|
0–10 | 5 | 5 |
10–20 | 8 | 13 |
20–30 | 15 | 28 |
30–40 | 9 | 37 |
40–50 | 3 | 40 |
n = 40, n/2 = 20. The first cumulative frequency to exceed 20 is 28, in class 20–30. So the median class is 20–30.
l = 20, cf = 13, f = 15, h = 10
Median = 20 + [(20 − 13) / 15] × 10 Median = 20 + (7/15) × 10 Median = 20 + 4.67 Median = 24.67
Answer: Median ≈ 24.67
Mode Formula
The mode is the value that appears most frequently in a dataset.
Mode Formula for Ungrouped Data
The mode is found by counting frequencies — no formula is needed.
Worked Example
Find the mode of {3, 5, 7, 5, 9, 5, 11}.
5 appears three times. Every other value appears once.
Answer: Mode = 5
A dataset can have more than one mode, or none at all:
Unimodal: one mode (e.g., {2, 4, 4, 6, 8} → mode = 4)
Bimodal: two modes (e.g., {2, 3, 3, 5, 7, 7, 9} → modes = 3 and 7)
Multimodal: more than two modes
No mode: every value appears with the same frequency (e.g., {1, 2, 3, 4, 5} → no mode)
Mode Formula for Grouped Data
Mode = l + [(f₁ − f₀) / (2f₁ − f₀ − f₂)] × h
Variable | Meaning |
|---|---|
l | Lower boundary of the modal class |
f₁ | Frequency of the modal class |
f₀ | Frequency of the class before the modal class |
f₂ | Frequency of the class after the modal class |
h | Class width |
The modal class is the class with the highest frequency.
Worked Example
Using the same frequency table:
Class | Frequency |
|---|---|
0–10 | 5 |
10–20 | 8 |
20–30 | 15 ← modal class |
30–40 | 9 |
40–50 | 3 |
Modal class = 20–30. l = 20, f₁ = 15, f₀ = 8, f₂ = 9, h = 10.
Mode = 20 + [(15 − 8) / (2(15) − 8 − 9)] × 10 Mode = 20 + [7 / 13] × 10 Mode = 20 + 5.38 Mode = 25.38
Answer: Mode ≈ 25.38
Differences Between Mean, Median, and Mode
The three measures often produce different answers on the same data. Consider the dataset {2, 3, 3, 4, 18}:
Mean = (2 + 3 + 3 + 4 + 18) / 5 = 6
Median = 3 (middle value)
Mode = 3 (most frequent)
The single outlier (18) pulls the mean up to 6, but the median and mode remain at 3. This illustrates the central distinction: each measure responds differently to the shape of the data.
Aspect | Mean | Median | Mode |
|---|---|---|---|
What it measures | Average of all values | Middle value | Most frequent value |
Data type | Numerical only | Numerical (ordered) | Numerical or categorical |
Affected by outliers | Yes, strongly | No | No |
Best for symmetric data | ✓ | ✓ | ✓ |
Best for skewed data | ✗ | ✓ | Sometimes |
Best for categorical data | ✗ | ✗ | ✓ |
Always exists | Yes | Yes | Not always |
Can have multiple values | No | No | Yes (bimodal/multimodal) |
Uses every data point | Yes | No | No |
The choice between them depends on the shape of the data and what the result needs to communicate.
When to Use Mean, Median, or Mode
Use the Mean When…
Data is roughly symmetric (no major outliers, no heavy skew).
Every data point should contribute to the result.
Examples: average exam scores in a balanced class, average daily temperature over a month, average rainfall.
Use the Median When…
Data is skewed or contains outliers.
A single extreme value would distort the average.
Examples: household income, house prices, salaries, response times.
A few high earners can pull the mean income for a country far above what most people actually earn. The median resists that pull and gives a more representative central value.
Use the Mode When…
Data is categorical (favourite colour, brand preference, shoe size).
The goal is to find the most common value, not the average.
Examples: most-sold product variant, most popular subject choice, peak hour of website traffic.
The mode is the only one of the three that works for non-numerical data.
The Empirical Relation Between Mean, Median, and Mode
For moderately skewed unimodal distributions, the three measures are connected by Karl Pearson's empirical formula:
Mode = 3 Median − 2 Mean
An equivalent form:
Mean − Mode = 3 (Mean − Median)
This is an empirical (observation-based) approximation, not a mathematical proof. It allows estimation of any one measure when the other two are known.
Worked Example
Given Mean = 22 and Median = 24, estimate the Mode.
Mode = 3(24) − 2(22) = 72 − 44 = 28
Answer: Mode ≈ 28
When the Empirical Formula Doesn't Work
The relation breaks down in several cases:
Highly skewed distributions — the approximation only holds for moderate skew.
Bimodal or multimodal data — the formula assumes a single mode.
Very small datasets — the distribution shape isn't reliable.
Symmetric distributions — mean, median, and mode are already equal, so the formula is redundant.
One Dataset, Three Answers
To see how the three measures diverge on the same data, consider the dataset:
{4, 8, 8, 11, 13, 14, 16, 18, 22}
Mean: (4 + 8 + 8 + 11 + 13 + 14 + 16 + 18 + 22) / 9 = 114 / 9 ≈ 12.67
Median: middle value of 9 ordered numbers = 5th value = 13
Mode: most frequent value = 8 (appears twice)
Measure | Value |
|---|---|
Mean | 12.67 |
Median | 13 |
Mode | 8 |
Three different answers from the same nine numbers. Each tells a different story about the data — the mean reflects all values, the median marks the centre point, and the mode identifies the most common observation.
Common Mistakes
Forgetting to arrange the data in ascending order before finding the median.
Confusing the position of the median with the value of the median. The formula gives the position; the value is read from the data.
Reporting "no mode" when one or more values do repeat. "No mode" applies only when every value appears the same number of times.
Using the mean when data has clear outliers, such as income or property prices. The result is misleading.
Treating the empirical relation as exact. It is an approximation for moderately skewed unimodal data.
Related Terms
Term | Meaning | How It Relates |
|---|---|---|
Range | Highest value − lowest value | A measure of spread, not centre |
Central tendency | The "middle" of a dataset | Mean, median, and mode are its three measures |
Skewness | Asymmetry of a distribution | Decides which measure best represents the data |
Outlier | A value far from the rest | Strongly affects the mean; not the median |
Frequency | Number of times a value appears | Used in grouped formulas and to find mode |
Standard deviation | Spread around the mean | Pairs with the mean to describe data |
Was this article helpful?
Your feedback helps us write better content



