What the IQR is and why you need it

The interquartile range, or IQR, measures the spread of the middle half of your data. It tells you how tightly or loosely the central 50 percent of your values cluster together. If your IQR is small, most of your data points sit close to each other. If it is large, they are scattered across a wider range.

The IQR is useful because it ignores the extreme highs and lows in your dataset—the outliers that can skew your picture of what is typical. When you are working with real-world measurements (test scores, household incomes, delivery times), the IQR often gives you a clearer sense of normal variation than the full range does.

You calculate the IQR by finding two specific values called quartiles, then subtracting one from the other. The process takes only a few minutes once you understand the steps.

Key Takeaways

  • The IQR is the difference between the third quartile (Q3) and the first quartile (Q1), representing the middle 50 percent of your data.
  • To find Q1 and Q3, you must first arrange your data in order from smallest to largest, then locate the median and divide the dataset into halves.
  • The position of each quartile depends on how many data points you have; use the formula (n+1)/4 for Q1 and 3(n+1)/4 for Q3, where n is your count.
  • If a quartile falls between two values, take the average of those two values rather than rounding up or down.
  • The IQR helps you spot outliers: any value below Q1 − 1.5×IQR or above Q3 + 1.5×IQR is often considered an outlier worth investigating.

Step 1: Arrange your data from smallest to largest

Before you can find quartiles, your numbers must be in order. Write them out or enter them into a spreadsheet column, starting with the smallest value and ending with the largest. Do not skip any values, even if some numbers repeat.

For example, if you have test scores of 78, 92, 65, 88, 92, 71, and 85, arrange them as: 65, 71, 78, 85, 88, 92, 92. You now have seven data points (n = 7).

Step 2: Find the median (the middle value)

The median is the value that sits exactly in the middle of your ordered list. If you have an odd number of data points, the median is the single middle value. If you have an even number, the median is the average of the two middle values.

In the test score example above with seven values, the median is the 4th value: 85. This median divides your data into a lower half (65, 71, 78) and an upper half (88, 92, 92). You do not include the median itself in either half when the count is odd.

If you had eight values instead, you would average the 4th and 5th values to get the median, then split the data so the lower half contains the first four values and the upper half contains the last four.

Step 3: Calculate Q1 (the first quartile)

Q1 is the median of the lower half of your data—the value that sits at the 25th percentile. To find its position, use the formula (n+1)/4, where n is your total count of data points.

Using the test score example: (7+1)/4 = 2. This means Q1 is at position 2 in your ordered list. Counting from the left, position 2 is the value 71. So Q1 = 71.

If the formula gives you a decimal (for example, 2.5), you must average the values at the two nearest positions. If the formula tells you position 2.5, average the values at position 2 and position 3, then use that average as Q1.

Step 4: Calculate Q3 (the third quartile)

Q3 is the median of the upper half of your data—the value at the 75th percentile. Use the formula 3(n+1)/4 to find its position.

For the test scores: 3(7+1)/4 = 6. Position 6 in your ordered list is 92. So Q3 = 92.

Again, if you get a decimal position, average the two nearest values. A position of 5.5 means you average the values at position 5 and position 6.

Step 5: Subtract Q1 from Q3 to get the IQR

Now that you have both quartiles, the IQR is straightforward the difference: IQR = Q3 − Q1.

For the test scores: IQR = 92 − 71 = 21. This tells you that the middle 50 percent of test scores span a range of 21 points.

An IQR of 21 is moderate—it suggests the central students' scores are reasonably spread out. If the IQR were 5, the middle half would be tightly clustered. If it were 40, they would be scattered across a much wider band.

Using the IQR to find outliers

One practical use of the IQR is identifying outliers—values that are unusually far from the rest. A common rule is to flag any value below Q1 − 1.5×IQR or above Q3 + 1.5×IQR as a potential outlier.

Using the test score example: Q1 = 71, Q3 = 92, IQR = 21. The lower boundary is 71 − (1.5 × 21) = 71 − 31.5 = 39.5. The upper boundary is 92 + (1.5 × 21) = 92 + 31.5 = 123.5. Any score below 39.5 or above 123.5 would be flagged as an outlier. In this dataset, all scores fall within the boundaries, so there are no outliers by this rule.

Outliers are not automatically errors—they may be real and important. But flagging them lets you investigate whether a value is a genuine extreme case or a data entry mistake.

Frequently Asked Questions

What is the difference between IQR and standard deviation?

The IQR measures spread using the middle 50 percent of data and ignores extremes. Standard deviation measures how far all values typically sit from the average, including outliers. For data with extreme values or a skewed shape, the IQR is often more representative of typical spread.

Can I calculate IQR in a spreadsheet?

Yes. In Excel or Google Sheets, use the QUARTILE function. For Q1, type =QUARTILE(range, 1). For Q3, type =QUARTILE(range, 3). Then subtract Q1 from Q3. This method handles the position calculations automatically and works the same way whether your count is odd or even.

What if my dataset has an even number of values?

The process is the same. Find the median by averaging the two middle values, then split the data in half (including the middle two values in both halves, or excluding them—either method is acceptable and gives nearly identical results). Then find Q1 and Q3 using the formulas.

Does the IQR change if I add or remove one data point?

Usually yes, because adding or removing a value shifts which positions Q1 and Q3 occupy. The effect is typically small unless the new value falls near the quartile positions themselves.

Why do some sources use different formulas for quartile position?

There are several valid methods for calculating quartile positions, and different textbooks and software use slightly different ones. The most common are the method shown here and the "inclusive" method, which includes the median in both halves. The results are close enough that for practical purposes, either method works. Use whichever your course or workplace requires.