How to find quartiles and the interquartile range

Quartiles divide a rank-ordered dataset into four equal parts. The Interquartile Range (IQR) measures the spread of the middle 50% of the data. This method applies to any univariate numerical dataset. Use it to identify outliers and assess data dispersion.

The setup

Order the dataset from smallest to largest. Count the total number of observations, let this be nn.

The steps

  1. Find the median (Second Quartile, Q2Q_2). If nn is odd, Q2Q_2 is the exact middle value. If nn is even, Q2Q_2 is the average of the two middle values. 2. Find the First Quartile (Q1Q_1). This is the median of the lower half of the data. Exclude Q2Q_2 from this half if nn is odd. 3. Find the Third Quartile (Q3Q_3). This is the median of the upper half of the data. Exclude Q2Q_2 from this half if nn is odd. 4. Calculate the Interquartile Range (IQR). Subtract Q1Q_1 from Q3Q_3: extIQR=Q3Q1 ext{IQR} = Q_3 - Q_1.

Checking the result

Verify that Q1Q2Q3Q_1 \le Q_2 \le Q_3. Approximately 25% of the data points should fall below Q1Q_1, 50% below Q2Q_2, and 75% below Q3Q_3.

Common errors

Forgetting to sort the dataset before finding the quartiles is a standard mistake. Another error is including the median in the upper and lower halves when computing Q1Q_1 and Q3Q_3 for an odd-numbered dataset.

Worked example

Find the quartiles and IQR for the dataset: 12, 5, 22, 30, 7, 36, 14, 42, 15, 53, 25.

Order the data: 5, 7, 12, 14, 15, 22, 25, 30, 36, 42, 53. Count n=11n = 11. Find Q2Q_2: The middle value is in the 6th position. Q2=22Q_2 = 22. Find Q1Q_1: The lower half is 5, 7, 12, 14, 15. The median of this half is 12. Q1=12Q_1 = 12. Find Q3Q_3: The upper half is 25, 30, 36, 42, 53. The median of this half is 36. Q3=36Q_3 = 36. Calculate IQR: extIQR=Q3Q1=3612=24 ext{IQR} = Q_3 - Q_1 = 36 - 12 = 24.

FAQ

Run your own problem

References: OpenStax Introductory Statistics, Chapter 2 · Khan Academy: Summarizing quantitative data

See also