If you have ever looked at a set of test scores, salaries, or daily temperatures and wondered how to divide them into meaningful parts, learning how do you find quartiles in a set of data is one of the most useful skills in statistics. So quartiles split a ranked dataset into four equal sections, making it easier to see where most values cluster and where extreme outliers might hide. Whether you are a student preparing for an exam, a researcher analyzing survey results, or a professional reviewing business metrics, understanding quartiles gives you a clearer picture of distribution than the average alone can provide.
What Are Quartiles?
Quartiles are three cut points that divide a sorted dataset into four equal parts, with each part containing 25 percent of the observations. The three quartiles are:
- First Quartile (Q1): The median of the lower half of the data. It marks the 25th percentile, meaning about 25 percent of the data falls below this value.
- Second Quartile (Q2): The median of the entire dataset. It marks the 50th percentile and splits the data exactly in half.
- Third Quartile (Q3): The median of the upper half of the data. It marks the 75th percentile, meaning about 75 percent of the data falls below this value.
Together, Q1, Q2, and Q3 create a roadmap of the data’s spread. The distance between Q1 and Q3 is called the interquartile range (IQR), which captures the middle 50 percent of values and is especially useful for identifying outliers Worth keeping that in mind..
Why Quartiles Matter in Data Analysis
The mean, or arithmetic average, can be misleading when a dataset contains extreme values. As an example, if nine people earn $30,000 per year and one person earns $1,000,000, the average income is skewed upward and does not represent what most people actually earn. Quartiles avoid this problem by focusing on position rather than raw magnitude.
Quartiles are also the foundation of box plots, which visually summarize minimum, Q1, median, Q3, and maximum values. Think about it: by comparing the distances between these points, you can quickly tell whether data is symmetric, skewed to the left, or skewed to the right. In short, quartiles turn a long list of numbers into a story about consistency, variability, and typical performance.
Step-by-Step: How Do You Find Quartiles in a Set of Data?
Finding quartiles by hand follows a logical sequence. While different textbooks and software packages may use slightly different conventions, the core steps remain the same Nothing fancy..
Step 1: Order the Data from Smallest to Largest
Before you can find any quartile, the dataset must be sorted in ascending order. Which means if your numbers are scattered, rearrange them first. This step is non-negotiable because quartiles depend on rank position.
Step 2: Find the Median (Q2)
The second quartile is simply the median of the full dataset It's one of those things that adds up..
- If the dataset has an odd number of values, the median is the middle number.
- If the dataset has an even number of values, the median is the average of the two middle numbers.
Step 3: Split the Data into Lower and Upper Halves
Once you have the median, divide the dataset into two halves:
- The lower half includes all values below the median.
- The upper half includes all values above the median.
Here is where conventions sometimes differ. Some methods include the median in
both halves when calculating Q1 and Q3, while others exclude it entirely.
- The Exclusive Method (Tukey’s Hinges): The median is excluded from both halves. This is common in introductory statistics courses and is the default in R (
type = 2) and Python’snumpy.percentilewithinterpolation='midpoint'. - The Inclusive Method (Mendenhall & Sincich / M&S): The median is included in both halves. This is often used in AP Statistics and is the default in Microsoft Excel (
QUARTILE.INC) and TI-84 calculators.
For an odd-sized dataset (e.g., 9 values):
- Exclusive: Lower half = first 4 values; Upper half = last 4 values. Median (5th value) is ignored for Q1/Q3.
- Inclusive: Lower half = first 5 values (includes median); Upper half = last 5 values (includes median).
For an even-sized dataset (e.g., 10 values):
- Both methods yield the same split: Lower half = first 5 values; Upper half = last 5 values. The median (average of 5th and 6th) is not a data point, so there is nothing to include or exclude.
Step 4: Find Q1 and Q3
Calculate the median of the lower half (Q1) and the median of the upper half (Q3) using the same logic as Step 2.
Example (Exclusive Method):
Dataset: 3, 5, 7, 8, 12, 13, 14, 18, 21 (n=9)
- Ordered: Already sorted.
- Q2 (Median): The 5th value = 12.
- Split (Exclude 12):
- Lower half:
3, 5, 7, 8→ Median (Q1) = (5+7)/2 = 6 - Upper half:
13, 14, 18, 21→ Median (Q3) = (14+18)/2 = 16
- Lower half:
- IQR: 16 - 6 = 10
Example (Inclusive Method - same dataset):
3. Split (Include 12):
* Lower half: 3, 5, 7, 8, 12 → Median (Q1) = 7 (the 3rd value)
* Upper half: 12, 13, 14, 18, 21 → Median (Q3) = 14 (the 3rd value)
4. IQR: 14 - 7 = 7
Pro Tip: Always check which method your software, textbook, or exam expects. Consistency within a single analysis is more important than the specific method chosen Practical, not theoretical..
Using Quartiles to Spot Outliers
The IQR is the engine behind the most common rule of thumb for flagging outliers: the 1.5 × IQR Rule.
- Calculate the IQR (Q3 – Q1).
- Multiply the IQR by 1.5.
- Lower Fence: Q1 – (1.5 × IQR)
- Upper Fence: Q3 + (1.5 × IQR)
- Any data point falling below the Lower Fence or above the Upper Fence is flagged as a potential outlier.
Using the Exclusive example above (Q1=6, Q3=16, IQR=10):
- 1.5 × IQR = 15
- Lower Fence = 6 – 15 = -9
- Upper Fence = 16 + 15 = 31
- Since all data points (3 to 21) fall within -9 and 31, this dataset has no outliers.
If the maximum value were 50 instead of 21, it would exceed the upper fence of 31, signaling a value worthy of investigation—not automatic deletion It's one of those things that adds up. Which is the point..
Quartiles in Modern Tools
You rarely need to calculate these by hand in professional settings. Here is how to get consistent results in the most common environments:
| Tool | Function / Code | Default Method |
|---|---|---|
| Excel / Google Sheets | =QUARTILE.Also, iNC(range, 1) for Q1 |
Inclusive (M&S) |
=QUARTILE. EXC(range, 1) for Q1 |
Exclusive (requires n≥4) | |
| R | quantile(x, type=2) |
Tukey (Exclusive) |
quantile(x, type=7) |
Default (Linear interpolation) | |
| Python (pandas) | `df['col'].quantile(0. |
The same result can be obtained in NumPy using np.percentile(array, 25), which also defaults to linear interpolation and therefore aligns with Type 7. In Python’s statistics module, quantiles(data, n=4, method='exclusive') offers an exclusive-style calculation for larger samples, while SQL platforms such as PostgreSQL provide PERCENTILE_CONT(0.25) WITHIN GROUP (ORDER BY column) for interpolated quartiles and PERCENTILE_DISC for discrete quartile values Most people skip this — try not to..
For very small datasets, these subtle differences can noticeably change
For very small datasets, these subtle differences can noticeably change the interpretation of the data. Let’s examine a few illustrative cases that highlight why the choice of algorithm matters.
A five‑point sample
Data: 2, 4, 6, 8, 10
-
Inclusive (M&S) method – Q1 is the median of the lower half including the overall median (12) Practical, not theoretical..
- Lower half:
2, 4, 6→ Q1 = 4 - Upper half:
6, 8, 10→ Q3 = 8 - IQR = 8 − 4 = 4
- Lower half:
-
Exclusive (Tukey) method – the median (6) is omitted That's the part that actually makes a difference..
- Lower half:
2, 4→ median of an even set is the average of the two middle values → Q1 = 3 - Upper half:
8, 10→ Q3 = 9 - IQR = 9 − 3 = 6
- Lower half:
Because the exclusive approach spreads the “inner” values farther apart, the IQR is larger, which in turn widens the fences (Q1 − 1.5 × IQR = ‑6, Q3 + 1.5 × IQR = 15). Here's the thing — in this tiny set, no point falls outside the fences, but the discrepancy between the two IQRs (4 vs. 6) already shows how a single outlier could be classified under one rule and not the other.
A six‑point sample
Data: 1, 3, 5, 7, 9, 11
-
Inclusive – lower half
1, 3, 5, 7→ median of four numbers = (3 + 5)/2 = 4 → Q1 = 4
upper half5, 7, 9, 11→ median = (7 + 9)/2 = 8 → Q3 = 8
IQR = 4 -
Exclusive – lower half
1, 3, 5→ Q1 = 3; upper half7, 9, 11→ Q3 = 9; IQR = 6
Again, the exclusive calculation yields a broader spread, which can affect outlier thresholds. If we appended a value of 20, the inclusive fences would be –2 and 14 (no outlier), whereas the exclusive fences would be –3 and 15 (still no outlier). That said, if the added value were 18, the inclusive upper fence (14) would flag it as an outlier, while the exclusive upper fence (15) would not.
Practical guidance for tiny samples
-
Prefer the inclusive method when n < 5.
The exclusive algorithm requires at least four observations to produce distinct lower and upper halves; otherwise it either returns the same value as Q1/Q3 or raises an error in some software packages. -
Document the chosen algorithm.
In a report or a reproducible workflow, note whether you used the inclusive, exclusive, or a linear‑interpolation approach. Readers can then assess whether the reported IQR aligns with their expectations Surprisingly effective.. -
Use reliable visual checks.
Even with a small dataset, a box‑plot or a simple histogram can reveal skewness or extreme points that the numeric fences might miss. Visuals complement the quantitative rule‑of‑thumb Small thing, real impact. Practical, not theoretical..
When to rely on quartiles versus alternatives
Quartiles are excellent for
Quartiles are excellent for describing the spread of skewed or heavy-tailed distributions because they resist the influence of extreme values. Day to day, unlike the mean and standard deviation, which can be distorted by a single outlier, the interquartile range focuses on the middle 50% of the observations. This makes quartiles especially well suited to ordinal data, income distributions, response times, and any setting where a few anomalous points should not dominate the summary It's one of those things that adds up..
Yet quartiles are not universally superior. When data are roughly symmetric and uncontaminated, the standard deviation is more statistically efficient and connects directly to parametric inference and z-scores. For even greater resistance to