Splits the data at the median and takes the median of each half to get the first and third quartiles. The interquartile range Q₃ − Q₁ measures the spread of the middle 50% of the data.
The quartiles are the three values that cut sorted data into four equal parts: the first quartile , the second (the median) and the third .
To find them, split the data at the median into a lower and an upper half, then take the median of each half. When the count is odd, the median itself is excluded from both halves.
The interquartile range is the width of the middle 50% of the data.
Take the eight values 12, 15, 18, 20, 25, 28, 31, 40.
The quartiles are exactly what a box plot draws: the bottom of the box is , the line inside it is the median, and the top is .
Unlike the standard deviation, they are barely affected by outliers. A common rule flags any value below or above as an outlier.