Statistical functions
QUARTILE.INC
Matches all 5 recorded answers
Recorded: 5 workbook cells. How we measure this · See the Rust code
Local names in 40 languages
| Language | Name in Excel |
|---|---|
| Arabic | QUARTILE.INC |
| Bulgarian | QUARTILE.INC |
| Czech | QUARTIL.INC |
| Danish | KVARTIL.MEDTAG |
| German | QUARTILE.INC |
| Greek | QUARTILE.INC |
| English (Australia) | QUARTILE.INC |
| English (United Kingdom) | QUARTILE.INC |
| English (United States) | QUARTILE.INC |
| Spanish | CUARTIL.INC |
| Estonian | QUARTILE.INC |
| Finnish | NELJÄNNES.SIS |
| French | QUARTILE.INCLURE |
| Hebrew | QUARTILE.INC |
| Croatian | QUARTILE.INC |
| Hungarian | KVARTILIS.TARTALMAZ |
| Indonesian | QUARTILE.INC |
| Italian | QUARTILE.INC |
| Japanese | QUARTILE.INC |
| Korean | QUARTILE.INC |
| Lithuanian | QUARTILE.INC |
| Latvian | QUARTILE.INC |
| Norwegian | QUARTILE.INC |
| Dutch | KWARTIEL.INC |
| Polish | KWARTYL.PRZEDZ.ZAMK |
| Portuguese (Brazil) | QUARTILE.INC |
| Portuguese (Portugal) | QUARTIL.INC |
| Romanian | QUARTILE.INC |
| Russian | КВАРТИЛЬ.ВКЛ |
| Slovak | QUARTILE.INC |
| Slovenian | QUARTILE.INC |
| Serbian (Latin) | QUARTILE.INC |
| Swedish | KVARTIL.INK |
| Thai | QUARTILE.INC |
| Turkish | DÖRTTEBİRLİK.DHL |
| Ukrainian | QUARTILE.INC |
| Vietnamese | QUARTILE.INC |
| Chinese (Simplified) | QUARTILE.INC |
| Chinese (Hong Kong) | QUARTILE.INC |
| Chinese (Traditional) | QUARTILE.INC |
Names from Microsoft's support site.
What it does
QUARTILE.INC(array, quart)
QUARTILE.INC(array, quart) returns a sample quantile of the data in array, at one of
five fixed probabilities selected by quart.
Sort the numeric values of array ascending and call them x_(1) <= x_(2) <= … <= x_(n). Let
k = quart / 4, so quart in {0, 1, 2, 3, 4} selects k in {0, 1/4, 1/2, 3/4, 1}. Define
the rank
h = 1 + k * (n - 1)
and let j = floor(h), g = h - j. Then
QUARTILE.INC = x_(j) + g * ( x_(j+1) - x_(j) )
which is the value at position h in the sorted data, obtained by linear interpolation between
the two adjacent order statistics when h is not an integer.
This is exactly type 7 in the Hyndman–Fan taxonomy of sample quantile definitions — the same
definition that is R's default quantile() and NumPy's default percentile(). Two properties
identify it:
- The rank runs from
1ton. Atk = 0the rank is1and atk = 1it isn, soQUARTILE.INC(A, 0)is the minimum andQUARTILE.INC(A, 4)is the maximum, exactly. The whole probability interval[0, 1]maps onto the data, which is what the inclusive in the name means and what distinguishes it from QUARTILE.EXC. - It is a continuous, piecewise-linear, non-decreasing function of
kon[0, 1], and a non-decreasing function of every data value. It is the linear interpolation of the inverse empirical distribution function evaluated at the plotting positions(i-1)/(n-1).
Because it interpolates, the result need not be one of the data values. QUARTILE.INC of an
integer data set is routinely a fraction.
At quart = 2 the rank is 1 + (n-1)/2 = (n+1)/2, which is the median rank, so
QUARTILE.INC(A, 2) = MEDIAN(A)
identically, for every n. This is one of the two quartile identities that both the inclusive
and exclusive definitions share; see QUARTILE.EXC.
There is no single correct definition of a sample quartile. Hyndman and Fan catalogue nine
in use across statistical packages, differing in the plotting positions they assign to the order
statistics and therefore in the rank formula. The type-7 answer that QUARTILE.INC returns is a
defensible convention, not a theorem, and a reader comparing Excel against another package should
expect a different number rather than a bug.
Arguments
| Argument | Meaning | Admissible |
|---|---|---|
array | The data set. Required. | Any range or array; numeric cells are used |
quart | Which quartile. Required. | 0, 1, 2, 3, 4 |
array is consumed by scanning. Text, logical values and blank cells in a scanned range are
skipped rather than converted — they do not become zeros and they do not enlarge n. This is the
ordinary aggregate scan policy described in
coercion and lifting, and it is the policy the reference
engine's percentile collector implements.
Try it
Quirks
Result and edge cases
Returns Number.
quart = 0andquart = 4return the minimum and maximum, soQUARTILE.INC(A, 0)isMIN(A)andQUARTILE.INC(A, 4)isMAX(A)over the numeric cells — a fact worth knowing mostly because it means those two quarts can never fail for a non-empty array.- Repeated values are ordinary: the sort is not distinct-value, and a data set that is
entirely one value returns that value at every
quart. - Non-numeric cells in
arrayare skipped, sonis the count of numeric cells, not the size of the range. A range of text returns#NUM!, becausen = 0. - Errors in
arraypropagate as themselves. arraygiven as a rectangular grid is flattened; the quartile is over all its numeric cells regardless of shape.
Errors
| Error | Condition | Source |
|---|---|---|
#NUM! | array is empty (no numeric values) | documented |
#NUM! | quart < 0 or quart > 4 after truncation | documented |
#VALUE! | quart is non-numeric text | shared coercion rule |
| propagated | An error value in array or in quart surfaces as that error | shared coercion rule |
How to implement
Numerical notes
The mathematics is exact selection plus one linear interpolation, so the error budget is small and entirely locatable.
The rank computation. h = 1 + k*(n-1) with k = quart/4 is computed in binary64. For
quart in {0, 2, 4} the value of k is exactly representable (0, 0.5, 1) and h is
exact whenever n-1 is. For quart in {1, 3}, k is 0.25 or 0.75 — also exactly
representable, both being dyadic rationals. This is a small piece of luck specific to quartiles:
the four-way split lands on binary fractions, so the rank arithmetic for QUARTILE.INC is exact
for every n up to the point where n-1 exceeds 2^53. The general
PERCENTILE.INC has no such luck, because k = 0.1 is not dyadic, and
its floor(h) can therefore land on the wrong side of an integer boundary. QUARTILE.INC does
not inherit that hazard.
lower + g * (upper - lower)
The sort. Values are sorted with a total-order comparison that falls back to "equal" for
incomparable pairs. Excel's value universe has no NaN, so this is unreachable from a worksheet;
it becomes reachable if a NaN arrives from an add-in boundary, and the result is then an
unspecified ordering rather than a diagnosed error. Signed zeros compare equal, so -0.0 and
0.0 may appear in either order; the returned value is 0 either way, but its sign bit is not
determined by the data.
Rust code
Show the CalcFunc source of this function
Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.
QUARTILE.INC · 1 lines · calc-func/src/catalogue/statistics.rs on GitHub18 quartile_inc "QUARTILE.INC" (2, 2) [R "array", V "quart"] |s, a, sv| { quartile(s, a, sv, false) }
Kernels shared with other functions
listcatalogue/statisticsquartilecatalogue/statisticspercentile_inc_kernelported/percentile_commonpercentile_exc_kernelported/percentile_commoninterpolate_sortedported/percentile_common
Argument and result plumbing
No implementation has been published with a Handbook test suite for this function.
Version differences
No comparison between specific Excel builds is recorded here yet. This does not establish that all builds behave alike.
Alternatives
Relationships
- QUARTILE.EXC is the exclusive sibling, Hyndman–Fan type 6. It uses
the rank
k*(n+1)instead of1 + k*(n-1), admits onlyquartin{1, 2, 3}, and is undefined on small samples. The two agree atquart = 2and disagree atquart = 1and3for essentially every data set. Neither supersedes the other; Excel publishes both because the statistical community uses both. QUARTILEis the legacy name, retained in the Compatibility category. Microsoft's replacement guidance pointsQUARTILEatQUARTILE.INC, and the two are documented as computing the same quantity. The Handbook does not treat that as an identity. A legacy alias and its modern name are two entry points that Excel is free to route to two different code paths; the observed agreement of a dotted name and its predecessor is a claim requiring evidence, not a definition. No such evidence is in the Handbook's record.- MEDIAN is the
quart = 2case. - SMALL and LARGE return order statistics without
interpolation. When you want an actual data value rather than a quantile, they are the correct
functions —
QUARTILE.INCwill happily return a number that is in no cell. - Readers confuse
QUARTILE.INCwithPERCENTRANK.INC, which runs the map the other way: data value in, probability out.
Named variants
No named variants are recorded yet.
Suggest a correction or contribute an implementation · For agents