Calculate IQR- Interquartile Range Guide

What the Heck Is IQR and Why Should You Care?

Interquartile Range (IQR) is simply the spread of the middle 50% of your data. You get it by subtracting the first quartile from the third quartile. That's it. Nothing fancy.

You use IQR to understand how spread out your data is without getting fooled by extreme outliers. Unlike range (which uses min and max), IQR ignores the top 25% and bottom 25% of values. This makes it useful when you're dealing with real-world data that often has weird outliers.

The Three Quartiles You Need to Know

Before you calculate anything, you need to understand the three numbers that make up IQR:

IQR = Q3 - Q1

How to Calculate IQR in 5 Steps

Here's the actual process. No fluff.

Step 1: Sort Your Data

Arrange all values from smallest to largest. This is mandatory. Skipping this step is the most common reason people get wrong answers.

Step 2: Find the Median (Q2)

Locate the middle value. If you have an odd number of data points, that's the exact middle. If you have an even number, average the two middle values.

Step 3: Split Into Halves

Divide your sorted data into two halves at the median. Include the median in both halves if you had an odd number of points. Exclude it if you had an even number.

Step 4: Find Q1 and Q3

Calculate the median of each half. The lower half's median is Q1. The upper half's median is Q3.

Step 5: Subtract

IQR = Q3 - Q1

Real Example: Test Scores

Let's say you have these 9 test scores:

72, 85, 90, 95, 98, 102, 108, 115, 120

Working Through It

Sorted data: already done. Median (Q2) = 98

Lower half: 72, 85, 90, 95 → Q1 = (85 + 90) / 2 = 87.5

Upper half: 102, 108, 115, 120 → Q3 = (108 + 115) / 2 = 111.5

IQR = 111.5 - 87.5 = 24

The middle 50% of test scores span 24 points. This tells you students are fairly clustered in the 87.5 to 111.5 range. Anyone scoring outside this band is either struggling badly or acing it.

IQR vs Other Measures of Spread

You need to know when IQR is the right tool.

MeasureWhat It UsesAffected by Outliers?Best For
IQRMiddle 50% (Q1 to Q3)NoSkewed data, real-world datasets
RangeMin to MaxYes, heavilyQuick estimate, no outliers
VarianceAll data pointsYesStatistical tests, probability
Standard DeviationAll data pointsYesNormal distributions

IQR wins when your data has outliers or doesn't follow a normal distribution. Range is useless if you have one extreme value. Variance and standard deviation get skewed by the same problems.

Using IQR to Find Outliers

This is where IQR becomes practical. You can identify outliers using the 1.5×IQR rule.

Going back to our test scores: Q1 = 87.5, Q3 = 111.5, IQR = 24

Lower fence: 87.5 - (1.5 × 24) = 87.5 - 36 = 51.5

Upper fence: 111.5 + (1.5 × 24) = 111.5 + 36 = 147.5

Our scores range from 72 to 120. All fall within the fences. No outliers here.

Common Mistakes That Give Wrong Answers

When to Use IQR (and When Not To)

Use IQR when:

Skip IQR when:

Quick Reference

If you just need the formula for a formula sheet:

IQR = Q3 - Q1

Where:

That's the whole thing. Sort, find medians, subtract. The math is straightforward. The hard part is not making a stupid sorting error or including/excluding the median incorrectly when splitting your data.