π Trusted by students, educators & researchers since 2017.
So far in this module, we have learned how to find the center of our data (Mean, Median, Mode) and how to measure its overall spread (Variance and Standard Deviation).
But sometimes, looking at the entire dataset at once isn’t helpful. If you take a standardized test like the CAT in India or GRE in the USA, you don’t just want to know the national average; you want to know exactly where you stand compared to everyone else.
To answer that, statisticians slice data into perfectly equal chunks using Percentiles and Quartiles.
Percentiles: The 100-Slice Method
A percentile tells you the value below which a specific percentage of the data falls. It essentially takes your entire dataset, lines it up from smallest to largest, and slices it into 100 equal pieces.
If you score in the 90th percentile on a math test, it does not mean you got a 90% on the test. It means your score was higher than 90% of the people who took the test.
- The 10th Percentile: The bottom tier. Only 10% of the data is lower than this point.
- The 50th Percentile: The exact middle. Half the data is below it, half is above it. (Notice a familiar face? The 50th percentile is just another name for the Median).
- The 99th Percentile: The elite tier. 99% of the data falls below this number.
Quartiles: The 4-Slice Method
While percentiles slice data into 100 pieces, Quartiles slice the data into just 4 equal quarters. They are simply the most important, famous percentiles, given their own special names.
- Q1 (The First Quartile): The 25th Percentile. This marks the boundary of the bottom 25% of your data.
- Q2 (The Second Quartile): The 50th Percentile. This is the Median. It cuts the data perfectly in half.
- Q3 (The Third Quartile): The 75th Percentile. This marks the boundary where the top 25% of your data begins.
Want to visualise this in action? We built a hands-on, interactive tool just for this. Check out our post on Quartiles including an Interactive Quartile Calculator and Visualiser to type in your own numbers and watch exactly how the computer slices them into quartiles in real-time.
The Interquartile Range (IQR): The Outlier Hunter
In the previous lesson, we learned that the Range (the maximum number minus the minimum number) is a terrible measure of spread because a single extreme outlier will completely ruin it.
Quartiles give us a brilliant mathematical fix for this problem: The Interquartile Range (IQR).
The IQR looks exclusively at the exact middle 50% of your data. It completely ignores the bottom 25% and the top 25%.
IQR = Q3 – Q1
By chopping off the extreme edges of the data, the IQR gives you a highly stable, honest look at where the majority of your normal data actually lives.
Statisticians also use the IQR to mathematically prove if a number is a genuine outlier. The standard rule in data science is that any data point that falls more than 1.5 times the IQR above Q3, or below Q1, is officially classified as an outlier and might need to be removed from your dataset.
How to Calculate Percentiles and Quartiles in Software
Here is how you can quickly slice your data using Excel, Python, and R.
Microsoft Excel
Excel has simple built-in functions for these. Assuming your data is in cells A1 through A10:
- Percentile: To find the 90th percentile, type
=PERCENTILE.INC(A1:A10, 0.90) - Quartiles: You can find Q1 by typing
=QUARTILE.INC(A1:A10, 1). Change the1to a2for the Median, or a3for Q3. - IQR: Excel doesn’t have a direct IQR formula, so you just subtract them:
=QUARTILE.INC(A1:A10, 3) - QUARTILE.INC(A1:A10, 1)
(Note: Excel also offers .EXC versions of these formulas which exclude the absolute minimum and maximum values, but .INC is standard for most basic descriptive statistics).
Python
The easiest way to calculate percentiles and quartiles in Python is by using the powerful numpy library.
import numpy as np
data = [12, 15, 22, 29, 34, 45, 51, 62, 78, 90, 105]
# Calculate the 90th Percentile
p90 = np.percentile(data, 90)
print(p90) # Output: 90.0
# Calculate Q1 (25th), Q2 (50th), and Q3 (75th)
q1 = np.percentile(data, 25)
q2 = np.percentile(data, 50)
q3 = np.percentile(data, 75)
# Calculate IQR
iqr = q3 - q1
print(f"Q1: {q1}, Q3: {q3}, IQR: {iqr}")
R
R uses the quantile() function to calculate both percentiles and quartiles natively.
data <- c(12, 15, 22, 29, 34, 45, 51, 62, 78, 90, 105)
# Calculate a specific Percentile (e.g., 90th)
quantile(data, probs = 0.90)
# Calculate all Quartiles at once (0%, 25%, 50%, 75%, 100%)
quantile(data)
# Calculate the IQR directly
IQR(data)
Now that we know how to find the centre, measure the spread, and slice our data into chunks, there is only one piece of Descriptive Statistics left. In the next lesson of this module, we are going to look at the physical shape of the data by exploring Skewness and Kurtosis.
πΊοΈ Part of Path 2: Descriptive Statistics
You are reading step 3 of our module on summarising data. Continue your journey below or view the full syllabus.
