How to Find the Interquartile Range- Step-by-Step Calculation Guide
What is the Interquartile Range?
The interquartile range (IQR) tells you the spread of your middle 50% of data. It's the distance between the 25th percentile (Q1) and the 75th percentile (Q3). Simple as that.
Unlike range, IQR ignores outliers and extreme values. If your dataset has a few wild numbers, IQR still gives you an honest picture of where most of your data actually sits. That's why analysts use it constantly for real-world data.
Formula: IQR = Q3 - Q1
Key Terms You Need to Know
- Q1 (First Quartile) — The median of the lower half of your data. 25% of values fall below it.
- Q2 (Second Quartile) — The overall median. Half your data sits below, half above.
- Q3 (Third Quartile) — The median of the upper half. 75% of values fall below it.
- Quartiles — Three values that split your data into four equal parts.
- Median — The middle value when you sort data from smallest to largest.
Step-by-Step Calculation
Here's how to calculate IQR in five steps:
- Sort your data from smallest to largest
- Find the median (Q2) — this is the middle value
- Split data into lower and upper halves — if you have an odd number of values, exclude the median from both halves
- Find Q1 — median of the lower half
- Find Q3 — median of the upper half
- Calculate IQR — subtract Q1 from Q3
Example Calculation
Dataset: 4, 7, 2, 9, 12, 5, 8, 14
Step 1: Sort the data: 2, 4, 5, 7, 8, 9, 12, 14
Step 2: Find the median. With 8 values, take the average of the 4th and 5th values: (7 + 8) / 2 = 7.5
Step 3: Split the data. Lower half: 2, 4, 5, 7. Upper half: 8, 9, 12, 14
Step 4: Q1 is the median of the lower half: (4 + 5) / 2 = 4.5
Step 5: Q3 is the median of the upper half: (9 + 12) / 2 = 10.5
Step 6: IQR = 10.5 - 4.5 = 6
The middle 50% of your data spans 6 units. That's your IQR.
What If You Have an Odd Number of Values?
Say your dataset is: 3, 5, 8, 12, 15, 18, 20
The median (Q2) is 12. Exclude it. Lower half: 3, 5, 8. Upper half: 15, 18, 20.
Q1 = median of 3, 5, 8 = 5
Q3 = median of 15, 18, 20 = 18
IQR = 18 - 5 = 13
Finding Outliers with IQR
The IQR method is the standard way to detect outliers. Use this rule:
- Lower bound: Q1 - (1.5 × IQR)
- Upper bound: Q3 + (1.5 × IQR)
Any value outside these bounds is a potential outlier.
Using our earlier example: Q1 = 4.5, Q3 = 10.5, IQR = 6
- Lower bound: 4.5 - (1.5 × 6) = 4.5 - 9 = -4.5
- Upper bound: 10.5 + (1.5 × 6) = 10.5 + 9 = 19.5
Values below -4.5 or above 19.5 are outliers. In our dataset (2, 4, 5, 7, 8, 9, 12, 14), nothing qualifies. That's what you want to see.
IQR vs Other Spread Measures
Here's how IQR stacks up against the alternatives:
| Measure | What It Does | Resistant to Outliers? | Best Use Case |
|---|---|---|---|
| IQR | Spread of middle 50% | Yes | Real-world data with extremes |
| Range | Max minus Min | No | Quick estimate, small datasets |
| Variance | Average squared deviation | No | Statistical inference, probability |
| Standard Deviation | Square root of variance | No | Normal distributions, quality control |
IQR wins when your data is messy. Range, variance, and standard deviation all get wrecked by a single extreme value.
Common Mistakes to Avoid
- Forgetting to sort data before calculating — everything depends on order
- Including the median in both halves when you have an odd number of values
- Confusing Q2 (median) with Q3 — Q2 is the middle, Q3 is the 75th percentile
- Using IQR for small datasets — you need at least 4 values for quartiles to make sense
- Mixing up percentile and percentage — Q1 is the 25th percentile, not 25%
When to Use IQR
IQR is the right choice when:
- Your data has outliers or is skewed
- You're comparing distributions that don't follow a normal curve
- You need a quick, robust measure of spread
- You're working with income, housing prices, test scores, or any real-world metric
Skip IQR when your data is normally distributed and well-behaved. In those cases, standard deviation gives you more information about the shape of your distribution.
Quick Reference: IQR Formula Card
- IQR = Q3 - Q1
- Lower outlier boundary = Q1 - 1.5(IQR)
- Upper outlier boundary = Q3 + 1.5(IQR)
Bookmark this. You'll use it every time you need to check data for outliers or describe spread without getting fooled by extreme values.