
Percentiles are one of the most practical tools in statistics, helping us understand exactly where a value sits relative to a group. When a student scores in the 90th percentile on a standardized test, it means they outperformed 90% of all test-takers — a single number that instantly communicates standing within a distribution. Percentiles appear across medicine, education, finance, and research, making them a foundational concept worth understanding thoroughly.
Calculating a percentile is more straightforward than it might initially appear. Whether you are working with a small dataset by hand or processing thousands of records in Excel, Python, or R, the underlying logic remains consistent: rank the data, locate the position, and interpret the result.
A percentile is a statistical measure that indicates the value below which a given percentage of observations in a dataset fall. If a data point sits at the 70th percentile, it means 70% of all values in the distribution are equal to or lower than that point. Percentiles do not describe the value itself — they describe its position relative to the rest of the data.
This makes percentiles fundamentally different from percentages. A student who scores 72% on an exam has answered 72% of questions correctly. That same student scoring in the 72nd percentile, however, has outperformed 72% of all students who sat the test — the score itself could be almost anything depending on how others performed.
Percentiles divide a dataset into 100 equal parts, each representing a 1% segment of the distribution. The 25th, 50th, and 75th percentiles hold special significance and are more commonly referred to as the first quartile (Q1), median, and third quartile (Q3), respectively. These markers are central to descriptive statistics and appear in tools such as box plots, where they visually summarize how data is spread across its range.
Percentiles are most useful when you need to understand a value’s position within a group rather than its raw magnitude. A blood pressure reading of 118 mmHg means little in isolation — knowing it falls in the 60th percentile for adults of a given age provides immediate clinical context. This relative framing is what makes percentiles so widely applied across fields where comparison and ranking matter.
In education, standardized tests such as the SAT, GRE, and IQ assessments report percentile ranks alongside raw scores precisely because they communicate standing within a reference population. A score of 1400 on the SAT only becomes meaningful when you know where it places a student among all test-takers.
Healthcare relies heavily on percentile charts for tracking child development. Pediatricians use height and weight percentiles to monitor growth over time, flagging values that fall unusually high or low as potential indicators worth investigating.
In finance, percentiles help analysts assess portfolio performance, income distribution, and risk. Reporting that a fund performed in the 85th percentile among peers communicates outperformance far more clearly than quoting an absolute return figure.
Percentiles are also preferable to means when data is skewed or contains outliers. Household income is a well-known example — because a small number of extremely high earners pull the average upward, the median (50th percentile) gives a more accurate picture of what a typical household actually earns.
The most widely used formula for locating a percentile within a dataset is:
Where L is the locator value that identifies the position of the percentile in the ordered dataset, P is the desired percentile (e.g., 25 for the 25th percentile), and N is the total number of values in the dataset.
Before applying this formula, the dataset must be arranged in ascending order — from the smallest value to the largest. The formula does not return the percentile value directly; it returns the position within the ranked list where that value is found.
Interpreting the result of L depends on whether it is a whole number or a decimal. If L is a whole number, the percentile is calculated by averaging the value at position L and the value at position L + 1. If L is a decimal, it is rounded up to the nearest whole number, and the value at that position in the ordered dataset is the percentile.
Consider a dataset of 20 exam scores. To find the 75th percentile:
Because L is a whole number, the 75th percentile is the average of the values at positions 15 and 16 in the ordered list.
To find the 40th percentile from the same dataset:
Here L is again a whole number, so the result is the mean of the 8th and 9th values. When L produces a decimal — say 8.4 — the value at position 9 (rounded up) is taken directly as the percentile.
Working through a percentile calculation by hand is the most effective way to build a solid understanding of what the statistic actually measures. The following example uses a dataset of 12 student test scores:
Dataset: 54, 72, 38, 91, 65, 47, 83, 29, 76, 60, 88, 55
Step 1: Arrange the Data in Ascending Order
Sort all values from smallest to largest before any calculation begins. Applying the formula to unsorted data will produce incorrect results.
Ordered dataset: 29, 38, 47, 54, 55, 60, 65, 72, 76, 83, 88, 91
Step 2: Determine the Percentile You Want to Find
For this example, the goal is to find the 70th percentile — the value below which 70% of scores fall.
Step 3: Apply the Locator Formula
Substitute the known values into the formula:
Step 4: Interpret the Locator Value
Because L = 8.4 is a decimal, round up to the nearest whole number: position 9.
Step 5: Identify the Value at That Position
Count through the ordered dataset to find the value at position 9:
| Position | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Value | 29 | 38 | 47 | 54 | 55 | 60 | 65 | 72 | 76 | 83 | 88 | 91 |
The value at position 9 is 76.
Step 6: State the Result
The 70th percentile of this dataset is 76. This means 70% of students scored at or below 76 on the test.
What If L Is a Whole Number?
If the locator formula had returned a whole number — say L = 8 — the process differs slightly. Rather than rounding up, average the values at positions 8 and 9:
In that case, 74 would be the 70th percentile. This averaging step ensures the result accurately reflects the boundary between the lower 70% and upper 30% of the distribution when the locator lands exactly on a data point.
The nearest rank method is the simplest approach and the one most closely aligned with the manual formula covered earlier. To find the Pth percentile, the dataset is sorted in ascending order and the value at position ⌈(P/100) × N⌉ is selected, where ⌈ ⌉ denotes rounding up to the nearest whole number.
This method is straightforward but can be imprecise with small datasets because it always returns an actual value from the dataset rather than interpolating between two values. For large datasets the difference is negligible, but for small samples it can produce results that feel like a poor fit for the true boundary between percentile groups.
The interpolation method addresses the limitations of nearest rank by calculating a weighted average between two adjacent values when the locator falls between positions. Rather than simply rounding up, this approach estimates where the percentile boundary falls between two real data points.
The formula used is:
Where is the value at the lower position, is the value at the upper position, and d is the decimal portion of the locator value L. If L = 8.4, then is the value at position 8, is the value at position 9, and d = 0.4.
This method is widely used in statistical software and produces smoother, more precise results — particularly useful when working with continuous data.
A further distinction exists between exclusive and inclusive percentile calculations, which differ in how they treat the endpoints of the distribution.
The inclusive method treats the minimum value as the 0th percentile and the maximum as the 100th percentile, spreading all values evenly across the full range. The exclusive method excludes the endpoints, treating the smallest and largest values as falling just inside the boundaries rather than at them. This affects how middle percentiles are positioned relative to the data.
Microsoft Excel implements both approaches through its two percentile functions. PERCENTILE.INC uses the inclusive method and is the default for most general purposes. PERCENTILE.EXC uses the exclusive method and is better suited to situations where the analyst wants to avoid treating any observed value as an absolute boundary of the distribution.
For most practical purposes — homework, report writing, and general data analysis — the nearest rank method or the inclusive interpolation method will produce acceptable results. When working in Excel, PERCENTILE.INC is the standard choice. Python’s NumPy uses linear interpolation by default, which aligns closely with the interpolation method above. R’s quantile() function offers nine distinct methods, with method 7 set as the default, also based on linear interpolation.
Excel provides built-in functions that make percentile calculations fast and reliable, removing the need for manual sorting and formula application. There are three functions available depending on the version of Excel being used and the calculation method required.
PERCENTILE.INC
PERCENTILE.INC is the standard percentile function in Excel and the one most analysts will use for general purposes. It uses the inclusive method, meaning it treats the minimum value in the dataset as the 0th percentile and the maximum as the 100th percentile.
Syntax:
=PERCENTILE.INC(array, k)
Example:
=PERCENTILE.INC(A1:A12, 0.70)
This returns the 70th percentile of all values in cells A1 through A12.
PERCENTILE.EXC
PERCENTILE.EXC applies the exclusive method, which excludes 0 and 1 as valid inputs for k. This function is more appropriate when the analyst does not want to treat the minimum or maximum observed values as absolute distributional boundaries.
Syntax:
=PERCENTILE.EXC(array, k)
Example:
=PERCENTILE.EXC(A1:A12, 0.70)
The result will differ slightly from PERCENTILE.INC for the same dataset, particularly at the extremes of the distribution. For most standard use cases, the difference is small and PERCENTILE.INC remains the preferred choice.
PERCENTILE (Legacy)
Older versions of Excel use the function PERCENTILE without a suffix. It behaves identically to PERCENTILE.INC and remains functional in current versions of Excel for backward compatibility, but Microsoft recommends using the newer suffixed functions in all current work.
Syntax:
=PERCENTILE(array, k)
PERCENTRANK Functions
Excel also includes functions that work in the reverse direction — rather than finding the value at a given percentile, they return the percentile rank of a specific value within a dataset.
PERCENTRANK.INC and PERCENTRANK.EXC both follow the same array and value syntax:
=PERCENTRANK.INC(array, x)
=PERCENTRANK.EXC(array, x)
Where x is the value whose percentile rank you want to find. These functions return a decimal between 0 and 1 representing the percentile rank — multiply by 100 to express it as a familiar percentile figure.
Step-by-Step Example in Excel
Using the same 12 exam scores from the earlier example — entered into cells A1 through A12 — finding the 70th percentile requires only a single formula entered into any empty cell:
=PERCENTILE.INC(A1:A12, 0.70)
Excel sorts and evaluates the data automatically, returning the result without any manual ordering or position counting. This makes the function particularly efficient when working with large datasets where manual calculation would be impractical.
Python offers several ways to calculate percentiles, with NumPy and SciPy being the most commonly used libraries for statistical work. Each approach is concise and scales easily from small datasets to large arrays with millions of values.
Using NumPy
NumPy’s np.percentile() function is the standard choice for percentile calculations in Python. It accepts an array of values and one or more percentile targets, returning results quickly even across large datasets.
Syntax:
python
import numpy as np
np.percentile(array, q)
Example:
python
import numpy as np
scores = [29, 38, 47, 54, 55, 60, 65, 72, 76, 83, 88, 91]
result = np.percentile(scores, 70)
print(result)
NumPy does not require the data to be sorted beforehand — it handles ordering internally. By default, np.percentile() uses linear interpolation, which aligns with the interpolation method discussed earlier, and may therefore return a value that does not appear explicitly in the original dataset.
Calculating Multiple Percentiles at Once
A particularly useful feature of np.percentile() is its ability to calculate several percentiles in a single function call by passing a list to the q parameter:
python
import numpy as np
scores = [29, 38, 47, 54, 55, 60, 65, 72, 76, 83, 88, 91]
p25, p50, p75 = np.percentile(scores, [25, 50, 75])
print(f"Q1: {p25}, Median: {p50}, Q3: {p75}")
This is especially convenient when generating a five-number summary or preparing data for a box plot.
Using np.nanpercentile()
When a dataset contains missing values represented as NaN, standard np.percentile() will return NaN for the entire result. The np.nanpercentile() function resolves this by ignoring missing values during calculation:
python
import numpy as np
scores = [29, 38, np.nan, 54, 55, 60, 65, 72, 76, np.nan, 88, 91]
result = np.nanpercentile(scores, 70)
print(result)
This makes np.nanpercentile() the safer choice when working with real-world datasets where missing entries are common.
Using SciPy
SciPy’s scipy.stats.scoreatpercentile() function provides an alternative approach and integrates naturally into workflows that already rely on SciPy for statistical testing or distribution fitting.
python
from scipy import stats
scores = [29, 38, 47, 54, 55, 60, 65, 72, 76, 83, 88, 91]
result = stats.scoreatpercentile(scores, 70)
print(result)
For most standard percentile calculations, NumPy and SciPy will return identical or near-identical results. SciPy becomes the more relevant choice when percentile calculations are part of a broader statistical analysis pipeline already using that library.
Using Pandas
When working with tabular data loaded into a Pandas DataFrame, the quantile() method provides percentile calculations directly on a column or the entire DataFrame. Note that Pandas expresses the percentile as a decimal between 0 and 1, consistent with Excel’s convention rather than NumPy’s.
python
import pandas as pd
data = pd.DataFrame({'scores': [29, 38, 47, 54, 55, 60, 65, 72, 76, 83, 88, 91]})
result = data['scores'].quantile(0.70)
print(result)
To calculate multiple percentiles across a DataFrame column simultaneously:
python
result = data['scores'].quantile([0.25, 0.50, 0.75])
print(result)
Pandas is the natural choice when the dataset is already structured as a DataFrame — avoiding the need to extract values into a separate array before calculating percentiles.
Percentiles, quartiles, and percent ranks are closely related concepts that are frequently confused with one another. Each describes a value’s position within a distribution, but they approach that description differently and serve distinct analytical purposes.
Percentiles
A percentile divides a dataset into 100 equal parts and identifies the value below which a given percentage of observations fall. The 80th percentile, for example, is the point in the distribution below which 80% of values sit. Percentiles are most useful when fine-grained positional information is needed — comparing an individual data point against the full spread of a large dataset.
Quartiles
Quartiles divide a dataset into four equal parts rather than one hundred. There are three quartile markers:
Quartiles are a subset of percentiles. Every quartile has a direct percentile equivalent, but not every percentile corresponds to a quartile. Quartiles are the preferred measure when the goal is to summarize how a dataset is distributed across its range — particularly in box plots, where Q1, Q2, and Q3 form the central structure of the visualization.
The range between Q1 and Q3 is known as the interquartile range (IQR), a key measure of statistical spread that is resistant to the influence of outliers.
Percent Rank
Percent rank works in the opposite direction to percentiles. Rather than asking “what value corresponds to the 70th percentile?”, percent rank asks “what percentile rank does this specific value hold within the dataset?”
The formula for percent rank is:
Where x is the value being ranked and N is the total number of values in the dataset.
If a score of 76 appears in a dataset of 12 values and 8 scores fall below it, its percent rank is:
That score sits at approximately the 72.7th percentile of the distribution. In Excel, this calculation is handled directly by PERCENTRANK.INC() and PERCENTRANK.EXC(), while Python’s Pandas library provides rank(pct=True) for the same purpose.
Side-by-Side Comparison
| Feature | Percentile | Quartile | Percent Rank |
|---|---|---|---|
| Divides data into | 100 parts | 4 parts | N/A |
| Input | A percentile value (0–100) | Q1, Q2, or Q3 | A specific data value |
| Output | The corresponding data value | The corresponding data value | A percentile rank (0–100) |
| Direction | Rank → Value | Rank → Value | Value → Rank |
| Common use | Standardized testing, growth charts | Box plots, IQR, data summaries | Ranking individuals within a group |
| Excel function | PERCENTILE.INC() | QUARTILE.INC() | PERCENTRANK.INC() |
| Python function | np.percentile() | np.percentile([25,50,75]) | df.rank(pct=True) |
