Mean, Median, and Mode Calculator
Use this unified calculator to find the mean, median, and mode for both ungrouped (raw) data and grouped (frequency distribution) data.
Quick Start
Choose your data type below, enter your values, and click Calculate:
| Mean, Median & Mode Calculator | |
|---|---|
| Data Type | Ungrouped (Raw Data) Grouped (Frequency Distribution) |
| Enter the X Values (Separated by comma,) | |
| Type of Frequency Distribution | DiscreteContinuous |
| Enter the Classes for X (Separated by comma,) | |
| Enter the frequencies (f) (Separated by comma,) | |
| Results | |
| Number of Observations (N): | |
| Sum of X values: | |
| Mean: | |
| Ascending order of X values: | |
| Median: | |
| Mode: | |
| Frequency distribution: | |
How to Use This Calculator
For Ungrouped (Raw) Data
Step 1: Select “Ungrouped (Raw Data)” as your data type
Step 2: Enter your data values separated by commas (e.g., 10, 15, 20, 25, 30)
Step 3: Click “Calculate”
Results will show:
- Number of observations (N)
- Sum of values
- Mean (average)
- Sorted values (in ascending order)
- Median (middle value)
- Mode (most frequent value)
For Grouped (Frequency Distribution) Data
Step 1: Select “Grouped (Frequency Distribution)” as your data type
Step 2: Choose frequency distribution type:
- Discrete: For individual class values (e.g., 10, 15, 20)
- Continuous: For class intervals (e.g., 10-20, 20-30, 30-40)
Step 3: Enter class values or intervals separated by commas
Step 4: Enter the corresponding frequencies separated by commas
Step 5: Click “Calculate”
Results will show:
- Number of observations (N)
- Mean of frequency distribution
- Median of grouped data
- Mode of frequency distribution
- Frequency distribution table
Formulas & Theory
Mean (Average)
The mean is the sum of all values divided by the number of values.
For Ungrouped Data
$$\overline{x} = \frac{\sum x_i}{n} = \frac{x_1 + x_2 + \cdots + x_n}{n}$$
Where:
- $x_i$ = individual data values
- $n$ = number of observations
- $\sum x_i$ = sum of all values
Example: For data {10, 15, 20, 25, 30}: $$\overline{x} = \frac{10 + 15 + 20 + 25 + 30}{5} = \frac{100}{5} = 20$$
For Grouped Data
$$\overline{x} = \frac{1}{N}\sum_{i=1}^{k}f_i x_i$$
Where:
- $x_i$ = class midpoint (for continuous) or class value (for discrete)
- $f_i$ = frequency of class i
- $N = \sum f_i$ = total number of observations
- For continuous distributions, $x_i$ = (lower limit + upper limit) / 2
Median (Middle Value)
The median is the value that divides the data into two equal halves when arranged in order.
For Ungrouped Data
Procedure:
- Arrange data in ascending order
- If n is odd: Median = middle value
- If n is even: Median = average of two middle values
Examples:
- Data {10, 15, 20, 25, 30}: Median = 20 (middle value, n=5 is odd)
- Data {10, 15, 20, 25}: Median = (15 + 20)/2 = 17.5 (n=4 is even)
For Grouped Data
$$\text{Median} = l + \left(\frac{\frac{N}{2} - F_<}{f}\right) \times h$$
Where:
- $l$ = lower boundary of the median class
- $N$ = total number of observations
- $F_<$ = cumulative frequency before the median class
- $f$ = frequency of the median class
- $h$ = class width (for continuous distributions)
Step-by-step:
- Find $N/2$
- Locate the class with cumulative frequency ≥ N/2 (this is the median class)
- Apply the formula above
Mode (Most Frequent Value)
The mode is the value that appears most frequently in the data.
For Ungrouped Data
Simply identify which value appears most often.
Examples:
- Data {10, 15, 20, 20, 25, 20}: Mode = 20 (appears 3 times)
- Data {10, 15, 15, 20, 25, 25}: Bimodal - modes are 15 and 25
- Data {10, 15, 20, 25, 30}: No mode (all appear once)
For Grouped Data
$$\text{Mode} = l + \left(\frac{f_m - f_1}{2f_m - f_1 - f_2}\right) \times h$$
Where:
- $l$ = lower boundary of the modal class (class with highest frequency)
- $f_m$ = frequency of the modal class
- $f_1$ = frequency of the class before modal class
- $f_2$ = frequency of the class after modal class
- $h$ = class width
Note: The modal class is the class interval with the highest frequency.
Worked Examples
Example 1: Ungrouped Data
Data: Test scores for 7 students: 65, 72, 68, 75, 72, 80, 70
Solution:
Step 1: Find Mean $$\overline{x} = \frac{65 + 72 + 68 + 75 + 72 + 80 + 70}{7} = \frac{502}{7} = 71.71$$
Step 2: Find Median Arrange in order: 65, 68, 70, 72, 72, 75, 80
- n = 7 (odd), so median = middle value = 72
Step 3: Find Mode
- 65 appears 1 time
- 68 appears 1 time
- 70 appears 1 time
- 72 appears 2 times (most frequent)
- 75 appears 1 time
- 80 appears 1 time
Mode = 72
Interpretation: On average, students scored 71.71. The middle score was 72, and the most common score was 72.
Example 2: Grouped Data (Continuous)
Problem: The following table shows the number of hours students studied per week. Calculate mean, median, and mode.
| Study Hours | 10-15 | 15-20 | 20-25 | 25-30 | 30-35 |
|---|---|---|---|---|---|
| Number of Students | 5 | 12 | 18 | 10 | 5 |
Solution:
Step 1: Create Calculation Table
| Class | Midpoint (x) | Frequency (f) | f×x | Cumulative Frequency |
|---|---|---|---|---|
| 10-15 | 12.5 | 5 | 62.5 | 5 |
| 15-20 | 17.5 | 12 | 210 | 17 |
| 20-25 | 22.5 | 18 | 405 | 35 |
| 25-30 | 27.5 | 10 | 275 | 45 |
| 30-35 | 32.5 | 5 | 162.5 | 50 |
| Total | 50 | 1,115 |
Step 2: Calculate Mean $$\overline{x} = \frac{\sum f_i x_i}{N} = \frac{1,115}{50} = 22.3 \text{ hours}$$
Step 3: Calculate Median
- N/2 = 50/2 = 25
- Cumulative frequency ≥ 25 is 35 (in class 20-25), so median class = 20-25
- l = 20, F_< = 17, f = 18, h = 5
$$\text{Median} = 20 + \left(\frac{25 - 17}{18}\right) \times 5 = 20 + \left(\frac{8}{18}\right) \times 5 = 20 + 2.22 = 22.22 \text{ hours}$$
Step 4: Calculate Mode
- Modal class = 20-25 (highest frequency = 18)
- l = 20, f_m = 18, f_1 = 12, f_2 = 10, h = 5
$$\text{Mode} = 20 + \left(\frac{18 - 12}{2(18) - 12 - 10}\right) \times 5 = 20 + \left(\frac{6}{14}\right) \times 5 = 20 + 2.14 = 22.14 \text{ hours}$$
Results:
- Mean = 22.3 hours (average study time)
- Median = 22.22 hours (middle value)
- Mode = 22.14 hours (most common study time)
Interpretation: Students study an average of 22.3 hours per week, with a median of 22.22 hours and most common value around 22.14 hours.
Key Differences: Ungrouped vs. Grouped Data
| Aspect | Ungrouped Data | Grouped Data |
|---|---|---|
| Data Format | Individual raw values | Classes with frequencies |
| Information Loss | None - exact values known | Some - exact values not known |
| Mean Calculation | Simple: sum all, divide by count | Weighted by frequencies using midpoints |
| Median Finding | Find exact middle value(s) | Estimate using class formula |
| Mode Identification | Find most frequent single value | Find class with highest frequency |
| When to Use | Small datasets, all values available | Large datasets, data already summarized |
| Accuracy | Exact values | Approximate values |
When to Use Ungrouped vs. Grouped
Use Ungrouped Data Calculator When:
- You have a small dataset with all individual values
- You need exact statistical measures
- Data hasn’t been summarized into groups
- Examples: Quiz scores for a small class, daily temperatures for a week
Use Grouped Data Calculator When:
- You have a large dataset already organized into classes
- Only frequency distribution is available (not raw data)
- Data ranges across many values
- Need to summarize large amounts of information
- Examples: Income distribution in a country, product weights from manufacturing, test score ranges across many students
Common Mistakes to Avoid
❌ WRONG: Using mean when data has extreme outliers ✓ RIGHT: Consider median as well when outliers present
❌ WRONG: Calculating mode for continuous grouped data without determining modal class first ✓ RIGHT: Always identify the class with highest frequency first
❌ WRONG: Using ungrouped data formula on grouped data with class intervals ✓ RIGHT: Use grouped data formula that accounts for class width
❌ WRONG: Assuming mode must exist ✓ RIGHT: Some datasets have no mode (all values appear once)
Interpretation Guide
What the Mean Tells You
- Average value of the dataset
- Affected by extreme values (outliers)
- Best used when data is relatively symmetric
What the Median Tells You
- Middle value - 50% of data above, 50% below
- Robust to outliers (not affected by extreme values)
- Better for skewed distributions
What the Mode Tells You
- Most common value
- Useful for categorical data and discrete values
- Can be multiple modes or no mode
Use Together for Better Understanding
Comparing all three measures reveals distribution shape:
- Mean ≈ Median ≈ Mode: Symmetric distribution
- Mean > Median > Mode: Right-skewed (positively skewed)
- Mean < Median < Mode: Left-skewed (negatively skewed)
Related Calculators & Tutorials
Explore related concepts:
- Variance and Standard Deviation
- Quartiles, Percentiles, Deciles
- Five-Number Summary
- Central Tendency Tutorial
More Descriptive Statistics: