Quartile
calculator.
Find Q1, Q3 and the interquartile range, using the rule your class or software uses.
- Q1, lower quartile
- 15
- Q2, the median
- 40
- Q3, upper quartile
- 43
The middle half of your 11 values runs from 15 to 43. The median sits closer to Q3 (3 below it, 25 above Q1), so the middle half stretches toward low values. Nothing is beyond the fences.
Your data, split into four parts
Each dot is one value, tinted by its part, and a hollow dot lies beyond a fence. Solid lines mark Q1, the median and Q3, and dashed lines mark the inner fences at −27 and 85. The parts hold 3, 3, 3, 2 values. The table of parts gives the same figures.
Working
- 1Put the values in order6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49
- 2The median is value number 6Q2 = 40
- 3Take the median of each half. The median stays out of both halves.Lower half: 6, 7, 15, 36, 39, so Q1 = 15Upper half: 41, 42, 43, 47, 49, so Q3 = 43
- 4The IQR is the distance from Q1 to Q343 − 15 = 28
- 5The inner fences sit 1.5 IQRs beyond the quartiles15 − 1.5 × 28 = −2743 + 1.5 × 28 = 85
- 6Bowley skewness compares the two sides of the median43 + 15 − 2 × 4028= −0.7857
- 7Check: Q1 plus the IQR lands on Q3, and the four parts hold every value15 + 28 = 433 + 3 + 3 + 2 = 11 values
The same data under each method
| Method | Q1 | Q3 | IQR | Flagged |
|---|---|---|---|---|
| Median out, yoursFlagged 0 | 15 | 43 | 28 | 0 |
| Median inFlagged 0 | 25.5 | 42.5 | 17 | 0 |
| Excel INCFlagged 0 | 25.5 | 42.5 | 17 | 0 |
| Excel EXCFlagged 0 | 15 | 43 | 28 | 0 |
The IQR runs from 17 to 28 across the methods, so say which one you used.
Compare two methods
Moving to Excel INC changes the IQR by 11 and flags 0 values instead of 0.
Fences for outliers
- Inner fences, 1.5 IQR
- −27 and 85
- Outer fences, 3 IQR
- −69 and 127
- Mild, beyond an inner fence
- None
- Extreme, beyond an outer fence
- None
Fences from the NIST/SEMATECH e-Handbook, section 7.1.6. A flagged value is a reason to look closer, not a reason to delete it.
What each part holds
| Part | From | To | Values |
|---|---|---|---|
| Lowest | 6 | 15 | 3 |
| Second | 15 | 40 | 3 |
| Third | 40 | 43 | 3 |
| Highest | 43 | 49 | 2 |
How it's worked out
Quartiles cut a sorted list into four parts that hold about the same number of values. Q1 has about a quarter of the values below it, Q2 is the median, and Q3 has about three quarters below it. The interquartile range, or IQR, is the width of the middle half.
Every method finds the median the same way, but no single rule for Q1 and Q3 ever won out. This tool offers the four you are most likely to meet.
- Median of halves, median left out. Split the sorted list at the median and take the median of each half. With an odd count, the median stays out of both halves. The Math Doctors tie this rule to the TI-83 and the Moore and McCabe textbook.
- Median of halves, median kept in. The same split, but with an odd count the median goes in both halves. This is Tukey's version.
- Position counted from the ends. This is type 7 in R's list of quantile rules and R's default. QUARTILE.INC in Excel gives the same answer on Microsoft's example.
- Position out of n + 1. This is type 6, which R says Minitab and SPSS use. QUARTILE.EXC in Excel gives the same answer on Microsoft's example.
The last two find a position in the sorted list, where is 0.25 for Q1 and 0.75 for Q3. When the position falls between two values, you go that fraction of the way from one to the next. A position of 3.5 means halfway from the third value to the fourth.
The fences from NIST sit beyond the quartiles. A value past an inner fence is a mild outlier, and a value past an outer fence is an extreme one.
Three more figures come from the same numbers. The quartile deviation is half the IQR. Bowley skewness compares the two sides of the median and always lies between −1 and 1. The coefficient of dispersion sets the spread against the size of the values, so you can compare sets on different scales.
Worked examples
Priya checks Excel against her calculator
Priya has 11 values: 6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49. The median is the sixth, 40. Leaving it out, the lower half has a median of 15 and the upper half a median of 43, so her IQR is 28.
Microsoft uses the same 11 values to show QUARTILE.EXC, which gives 15 and 43, matching her halves. QUARTILE.INC is different: it lands on 25.5 and 42.5, an IQR of 17. Nobody made an error, and the median is 40 under every rule. The two methods simply answer with different quartiles.
Sam finds an even count easier by hand
Sam has 1, 2, 4, 7, 8, 9, 10, 12. The median is halfway between 7 and 8, so 7.5. The halves are 1, 2, 4, 7 and 8, 9, 10, 12, with medians of 3 and 9.5. With an even count, the median is in neither half, so the two halves methods agree: both give an IQR of 6.5.
His spreadsheet says 3.5 for Q1 instead. QUARTILE.INC finds position 2.75, which is three quarters of the way from 2 to 4, and Microsoft's own example shows that same 3.5. Q3 sits at 9.25, so the IQR comes to 5.75. Sam should report the rule his teacher expects.
One salary out of thirteen is far above the rest
Thirteen salaries in thousands of dollars run from 38 to 61, plus one of 240. The mean is 63.2 and the standard deviation is 53.6, both pulled up by one person. The quartiles barely notice: Q1 is 43, the median is 48, Q3 is 56.5, and the IQR is 13.5.
The upper outer fence is 97, so 240 is an extreme outlier. Take it out and the standard deviation falls to 7.1, while the IQR moves only from 13.5 to 10.5. That is why the IQR suits pay, house prices and other figures with a long tail.
Reading your result
Say which method you used. On Priya's 11 values the IQR is 28 or 17, depending on the rule. With 1,001 evenly spaced values, the four methods give an IQR from 500 to 501, so the choice matters most in small sets.
Read the median against the quartiles. If the median sits closer to Q1, the upper part of the middle half is longer and Bowley skewness is positive. A value near 0 means the two sides match, whatever the tails are doing, because this measure never looks past the quartiles.
Treat the fences as a screen. A flagged value deserves a second look, not automatic deletion. Even on perfectly normal data, about 0.7% of values fall beyond the inner fences, which comes to roughly 7 in every 1,000. In a list of 10,000 readings, you should expect to see some.
To draw the same figures as a chart, use the box plot calculator. For another cut point, such as the 90th percentile, use the percentile calculator.
Common mistakes
- Mixing methods. A Q1 from a calculator and a Q3 from a spreadsheet do not belong in one IQR. Use one rule for both, and for every group you compare.
- Forgetting to sort. By hand, the median and the halves only mean something once the list is in order. An unsorted list gives a confident wrong answer.
- Reading an IQR of 0 as no spread. With 5, 5, 5, 5, 5, 5, 5, 5, 6, 9, Q1 and Q3 are both 5, the IQR is 0, and the fences sit on top of it. Every value that is not 5 gets flagged, which says more about the repeated values than about outliers.
- Trusting quartiles from very few values. With the values 1 to 7, the type 6 rule gives Q1 = 2 and Q3 = 6, each a single value from the list. Add or drop one value and the answer can jump, so report the method and the count.
Questions people ask
Sources
- NIST/SEMATECH e-Handbook of Statistical Methods, section 7.1.6, What are outliers in the data?
- R documentation, quantile
- Microsoft, QUARTILE.INC function
- Microsoft, QUARTILE.EXC function
- The Math Doctors, The Many Meanings of Quartile
- MetricGate, Bowley skewness
- Wikipedia, Quartile coefficient of dispersion