Key Points
The interquartile range formula is , the distance between the third and first quartiles.
The NIST e-Handbook of Statistical Methods defines the interquartile range as the value of the 75th percentile minus the value of the 25th percentile.
The IQR spans the middle 50 per cent of the data, so it ignores the smallest quarter and the largest quarter entirely.
Because it discards both tails, the interquartile range is unaffected by extreme values in a way the full range never is.
The NIST e-Handbook builds its outlier fences from the IQR, placing inner fences 1.5 times the IQR beyond each quartile.
What Is the Interquartile Range Formula?
The interquartile range formula measures the spread of the middle half of a data set, and is written
where is the first quartile and the third. The NIST/SEMATECH e-Handbook of Statistical Methods states that the difference is called the interquartile range.
The Full Definition
Quartiles cut an ordered data set into four parts of equal count. sits where a quarter of the values lie below it, is the median, and sits where three quarters lie below it.
The interquartile range is the width of the block between and . Half the observations fall inside it, a quarter below it and a quarter above it.
That construction is the whole point. By measuring only the central half, the IQR reports a spread that the most extreme values cannot influence at all.
How NIST Locates the Quartiles
Quartiles are not quite as settled as they look, because there is more than one convention for locating them. The NIST e-Handbook's worked example takes at the th ordered point and at the th ordered point, interpolating when that position falls between two values.
For , that puts at the 3rd ordered value and at the 9th, both exact positions with no interpolation needed. For , falls at position 2.75, which means interpolating between the 2nd and 3rd values.
Other conventions exist, and software packages do not all agree. Two defensible methods can give slightly different quartiles for the same small data set, which is why a reported IQR should say which method produced it.
Variable Key
Symbol | Meaning | Unit or type | Notes |
|---|---|---|---|
interquartile range | same units as the data | the quantity being computed | |
first quartile | same units as the data | the 25th percentile | |
third quartile | same units as the data | the 75th percentile | |
median | same units as the data | not used in the formula itself | |
number of observations | count | sets the quartile positions |
Examples of the Interquartile Range Formula
Example 1
Find the interquartile range of 2, 4, 5, 7, 8, 11, 12, 15, 18, 19, 27.
There are values, already ordered. Using the rule, is the 3rd value and is the 9th:
Final answer:
Example 2
Find the interquartile range of 9, 2, 15, 4, 11, 7, 20 without sorting first.
The formula says subtract from , and the data looks ready to use. Taking the quartiles from the positions as given, the 2nd value is 2 and the 6th is 7:
That gives 5. But the data set runs from 2 to 20, so a middle-half spread of 5 is implausibly narrow, and the "quartiles" picked out two values that are nowhere near the 25th and 75th percentiles.
Quartiles are positional, so the data must be ordered before any position means anything. Sorted, the set is 2, 4, 7, 9, 11, 15, 20, with , putting at the 2nd value and at the 6th:
Final answer:
Example 3
Find the interquartile range of 10, 20, 30, 40, 50, 60, 70, 80, 90, 100.
With , sits at position , so interpolate 75 per cent of the way from the 2nd value to the 3rd:
sits at position , so interpolate a quarter of the way from the 8th to the 9th:
Final answer:
Example 4
Two data sets share the same range. Set A is 1, 50, 50, 50, 99 and set B is 1, 25, 50, 75, 99. Compare their interquartile ranges.
Both run from 1 to 99, so both have a range of 98. With , is at position 1.5 and at position 4.5, so each is a midpoint of two neighbours.
For A, and , giving . For B, and , giving .
Final answer: for A and for B.
Identical ranges, very different central spreads. The range saw only the endpoints, which both sets share.
Example 5
A data set has and . Find the IQR and the NIST inner fences.
The NIST e-Handbook places inner fences 1.5 times the IQR beyond each quartile:
Final answer: , with inner fences at 8 and 72.
Any value below 8 or above 72 would be flagged as a mild outlier by that rule.
Don't Confuse the IQR With the Range or the Quartile Deviation
Quantity | Formula | What it uses |
|---|---|---|
Interquartile range | the middle 50 per cent | |
Range | largest minus smallest | only the two extreme values |
Quartile deviation | half the IQR, also called the semi-interquartile range | |
Standard deviation | every value, with squared weighting |
The quartile deviation is the one most often mistaken for the IQR, because it is built from the same two numbers. If a question asks for spread "about the median" using quartiles, it usually wants the halved version.
Where Intuition Breaks on the Interquartile Range
Mistake 1: Computing quartiles on unsorted data
Where it slips in: The formula names and rather than positions, so the ordering step is easy to treat as optional.
Don't do this: Read quartiles off the data in the order it was collected.
The correct way: Sort ascending first, then locate the quartile positions. An IQR that looks too small for the visible spread is the signature of unsorted data.
Students who write the sorted list as a separate line, rather than sorting mentally, rarely lose this step, because the sorted row becomes the thing they read positions from. It also makes the median visible as a free check.
Mistake 2: Treating the IQR as if it used every value
Where it slips in: It is a measure of spread, and most measures of spread respond to every observation.
Don't do this: Expect the IQR to change when an extreme value is made more extreme.
The correct way: Remember that moving the largest value from 100 to 10,000 leaves and untouched, so the IQR does not move at all. That insensitivity is a feature, not a defect.
Mistake 3: Mixing quartile conventions within one comparison
Where it slips in: One figure comes from a spreadsheet and another from a textbook method, and the two use different quartile definitions.
Don't do this: Compare an IQR computed by one convention against an IQR computed by another.
The correct way: Use a single method throughout and say which one. On small data sets the gap between conventions can be larger than the difference you are trying to measure.
Wrapping Up
The interquartile range formula is , the spread of the middle half of the data.
Quartiles are positional, so the data must be sorted before the formula means anything.
The IQR ignores the top and bottom quarters, which is why extreme values cannot shift it.
More than one quartile convention exists, so an IQR from a small sample should state the method used.
To work through data handling with a teacher, explore a 7th grade math tutor or math tuition.
Your Next Move
Find the IQR of 3, 6, 7, 9, 12, 14, 21, 25. Then change the 25 to 250 and recompute, confirming that the IQR does not move.
Want a live Bhanzu trainer to walk through more statistics problems? Book a free demo class.
Read More
Was this article helpful?
Your feedback helps us write better content