How this calculation works
Sort the observations and select the requested quantile convention. Type 7 interpolates between neighboring sorted values using zero-based location (n−1)p. Nearest rank returns an observed value. The same selected convention is applied to quartiles and the reported median.
Type 7: h = (n−1)p; nearest rank: ceil(np), clamped at the first observationA worked example
For 10,20,30,40, the 25th percentile is 17.5 with type 7 and 10 with nearest rank. Both methods return the minimum at 0% and maximum at 100%.
Good to know
Unweighted descriptive calculations for up to 1,000 observations within ±1 trillion. Floating-point arithmetic and rounded display are used. No missing values are silently removed, no population distribution is inferred, and no confidence intervals are supplied.
Reference: NIST: percentile conventions (opens in a new tab) ↗
A percentile value and a percentile rank answer opposite questions
A sample percentile starts with a requested proportion and returns a value. A percentile rank starts with a value and counts its position relative to observations. The two operations are not exact inverses under every sample convention, especially with ties or interpolation.
For the four observations 10,20,30,40, type 7 locates the 25th percentile three quarters of the way from the first observation to the second, giving 17.5. Nearest rank selects position ceil(4 × 0.25), giving 10. Neither answer can be interpreted without naming the method.
Type 7 uses zero-based position h = (n − 1)p. Equivalently, its one-based position is 1 + (n − 1)p. Mixing those indexing conventions can shift the selected pair and produce a plausible but incorrect calculation.
Keep quartile conventions consistent through an analysis
The tool applies the selected convention to Q1, the median and Q3 as well as the requested percentile. For an even sample, nearest-rank 50% selects the lower middle observation; it does not automatically average the two middle values.
The interquartile range is Q3 − Q1 using those same quartiles. If another program uses median-of-halves quartiles, its result may differ. Reconcile methods before interpreting a difference as a software error or a changed dataset.
A sample percentile describes the supplied reference data. It does not supply uncertainty about an unknown population percentile, adjust for survey weights or account for missing observations. Retain the sample definition and method when sharing the result.
A few questions, answered
What happens at 0% and 100%?
Both offered methods return the sample minimum at 0% and maximum at 100%.
Does interpolation create an extra observation?
No. It returns a summary value between observations; the dataset itself is unchanged.
Which method must I use?
Use the convention specified by your course, analysis protocol or comparison software. This tool makes the choice visible rather than asserting one universal convention.