State the quartile rule before splitting the ordered data
Quartile conventions can give different answers for the same small data set. This page uses one named rule throughout: sort the data, exclude the overall median from both halves when the count is odd, then take each half's median.
All data sets are invented and have at least two observations. We use the exclusive median-of-halves convention, not a universal software percentile rule or a claim about the method required by a particular exam. Follow the rule specified in your own question.
Order, split, take medians, then subtract
- Sort every observation from smallest to largest. Keep repeated values as separate observations.
- Find the overall median Q2. For an even count, average the two middle values; for an odd count, use the single middle value.
- For even n, split into two equal halves. For odd n, leave the one overall middle observation out of both halves. The lower-half median is Q1; the upper-half median is Q3.
- Compute IQR = Q3 − Q1. It has the same unit as the observations and cannot be negative.
The halves are based on ordered positions, not on equal numerical gaps. This named convention is one of several legitimate quartile conventions. A different result under another stated convention need not be a calculation error.
Eight observations: average within each half
Using the exclusive median-of-halves rule, find Q1, Q2, Q3 and IQR for 14, 3, 9, 5, 18, 11, 7, 13.
- Order: 3, 5, 7, 9, 11, 13, 14, 18. Q2 = (9 + 11) / 2 = 10.
- Lower half: 3, 5, 7, 9, so Q1 = (5 + 7) / 2 = 6. Upper half: 11, 13, 14, 18, so Q3 = (13 + 14) / 2 = 13.5.
- IQR = 13.5 − 6 = 7.5.
Answer: Q1 = 6; Q2 = 10; Q3 = 13.5; IQR = 7.5
Check: The order 3 ≤ 6 ≤ 10 ≤ 13.5 ≤ 18 is consistent. The quartiles need not themselves be observed values.
Nine observations: leave out the overall median
Using the exclusive median-of-halves rule, find Q1, Q2, Q3 and IQR for 22, 4, 12, 8, 30, 16, 6, 20, 10.
- Order: 4, 6, 8, 10, 12, 16, 20, 22, 30. Q2 is the fifth value, 12.
- Exclude that middle 12. Lower half: 4, 6, 8, 10, giving Q1 = 7. Upper half: 16, 20, 22, 30, giving Q3 = 21.
- IQR = 21 − 7 = 14.
Answer: Q1 = 7; Q2 = 12; Q3 = 21; IQR = 14
Check: If instead the median were included in both halves, this data set would give Q1 = 8 and Q3 = 20. That is a different convention, not the rule used here.
Repeated values keep their positions
Using the exclusive median-of-halves rule, find Q1, Q2, Q3 and IQR for 5, 2, 5, 9, 2, 5, 12.
- Order: 2, 2, 5, 5, 5, 9, 12. Q2 is the fourth observation, 5.
- Leave out only that middle observation. Lower half: 2, 2, 5, giving Q1 = 2. Upper half: 5, 9, 12, giving Q3 = 9.
- IQR = 9 − 2 = 7.
Answer: Q1 = 2; Q2 = 5; Q3 = 9; IQR = 7
Check: The other two observations equal to 5 remain in their halves. Excluding the median position does not mean deleting every copy of its value.
Do not split the unsorted list
In the first example, splitting the original order into 14, 3, 9, 5 and 18, 11, 7, 13 gives half-medians 7 and 12. Those are not the ordered-position quartiles 6 and 13.5. Sort the complete data set before forming either half.
Try the next two before opening their checks.
Self-check 1: negative values still sort normally
Using the exclusive median-of-halves rule, find Q1, Q2, Q3 and IQR for −2, −10, 4, −6, 8, 0.
Show the worked self-check
- Order: −10, −6, −2, 0, 4, 8. Q2 = (−2 + 0) / 2 = −1.
- The halves are −10, −6, −2 and 0, 4, 8. Thus Q1 = −6 and Q3 = 4.
- IQR = 4 − (−6) = 10.
Answer: Q1 = −6; Q2 = −1; Q3 = 4; IQR = 10
Check: A quartile can be negative. IQR is still nonnegative because Q3 is at least Q1.
Self-check 2: no spread in a constant data set
Using the exclusive median-of-halves rule, find Q1, Q2, Q3 and IQR for 7, 7, 7, 7, 7.
Show the worked self-check
- Q2 is the third 7. Excluding that one observation leaves two 7s in each half.
- Each half has median (7 + 7) / 2 = 7.
- IQR = 7 − 7 = 0.
Answer: Q1 = 7; Q2 = 7; Q3 = 7; IQR = 0
Check: All observations are identical, so all quartiles coincide and the interquartile range is zero.
Scope and limits
- For odd n, remove the single middle observation from the halves, not every observation equal to it.
- Different quartile conventions can produce different values. State and follow the required convention instead of calling every different answer wrong.
- With one observation, this exclusive rule leaves empty halves, so it does not define Q1 or Q3.
- This page computes quartiles and IQR only. It does not classify outliers, make population claims or promise any spreadsheet output.
Common questions
Must a quartile be one of the observations?
No. A half with an even count uses the mean of its two middle values, which may lie between observed values.
Do I include the median in the halves for odd n?
Not under this page's exclusive rule. Exclude the single middle observation from both halves. Other conventions can include it, so follow the rule in your question.
Should repeated values be removed before finding quartiles?
No. Each occurrence is an observation with its own ordered position. Keep repeats; exclude only the one middle position when the total count is odd.
Is IQR the same as the range?
No. IQR is Q3 minus Q1. The range is maximum minus minimum. Both are nonnegative, but they use different positions in the ordered data.
Sources and scope
Sources checked . OpenStax supplies the quartile and IQR ideas. Langford describes multiple conventions, including Method 2; Clinical Biostats states the exclusive median-of-halves procedure. All data and worked examples here are original EZT practice.