Ask Excel, Python, R, and a textbook for Q1 of the same dataset and you may get three different answers. All of them are "correct" — quartiles have no single definition, only conventions. Understanding the main conventions saves you from thinking your tool is broken.
The Median-of-Halves Family
Tukey hinges: split the sorted data at the median; if n is odd, include the median in both halves. Q1 and Q3 are the medians of those halves. Moore & McCabe (common in US textbooks): same idea, but exclude the median from both halves when n is odd. For n = 11, the two methods give different Q1 values; for even n they agree.
The Interpolation Family (Hyndman & Fan)
Hyndman and Fan's 1996 paper cataloged nine quantile definitions used by statistical software. They differ in how they position the p-th quantile between order statistics. The most important one in practice:
- Type 7 (linear interpolation) — the default in R, Python's NumPy and pandas, and this site. Q1 is interpolated as the value at position 1 + (n−1) × 0.25 in the sorted data.
- Type 2 — closest to the Tukey hinge convention.
- Excel's QUARTILE.INC — equivalent to type 7;
QUARTILE.EXCis a different type again.
Does the Difference Matter?
For small samples, yes — with n = 8, different methods can place Q1 a full data point apart, which moves the fences and can flip borderline outlier flags. For n in the hundreds, all common methods converge to nearly identical values. The practical rules:
- Report which method you used when quartiles matter (this site documents type 7 on every tool page).
- Don't compare quartiles computed by different software without checking conventions.
- For small datasets, treat any single quartile as approximate and look at the full sorted data — a stem-and-leaf plot keeps every value visible.