This is the last of three pages on the statistical category of ECMA-376 5th edition Part 1 (December 2016) section 18.17.7. It covers the 29 functions from PEARSON (18.17.7.247) to ZTEST (18.17.7.356) in alphabetical order; AVEDEV to GAMMALN and GEOMEAN to NORMSINV come before it. For each function the page gives what it takes and returns, the standard’s example, what [MS-OI29500] v20260818 says Office does differently where it has a note, and what LibreOffice returns. Section numbers are the standard’s own.
How the examples were checked
The standard’s examples and the edge cases were written as 234 formulas in
samples/xlsx/oracle/statfn3/formulas.txt, built into a real XLSX with
samples/xlsx/oracle/make-xlsx.mjs (formula cells without cached values) and converted to CSV by
LibreOffice (soffice --headless --convert-to csv). LibreOffice is an implementation, not the
standard: where it differs the difference is reported, not corrected. Its errors appear in its own spellings:
Err:502 (invalid argument, the standard’s #NUM! in most cases) and Err:504 (error
in the parameter list). TREND, which returns an array, was read one element at a time with
INDEX(…, row, column). The standard gives no example for TREND and ZTEST; the ZTEST
rows use ten values chosen for the test, so they show LibreOffice’s behaviour only.
The 29 functions
Argument names are the standard’s. Optional arguments are in brackets. The standard’s results are its printed digits; LibreOffice’s are its full precision.
| Function | Arguments and result | Standard’s example | LibreOffice |
|---|---|---|---|
PEARSON (.247) | array-1, array-2 (numbers, names, arrays or references): the Pearson product moment correlation coefficient, from −1 to 1. Text, logicals and empty cells in an array or reference are ignored, zeros included. Different sizes or empty: unspecified. MS-OI29500 2.1.1013: x and y are individual values and x̄ and ȳ the averages (the standard maps x and y to the averages) | PEARSON({9,7,5,3,1},{10,6,1,5,3}) = 0.699378606 | 0.699378606180235; perfect lines 1 and -1; a constant array #DIV/0!; different sizes Err:502; one pair #DIV/0!; with a TRUE in F1:F4 against H1:H4 0.7559 (the logical used) |
PERCENTILE (.248) | array, k (k from 0 to 1): the k-th percentile, interpolating if k is not a multiple of 1/(n−1). #NUM! if k < 0 or k > 1; empty array: unspecified. MS-OI29500 2.1.1014: Office returns 0 for an empty array | PERCENTILE({1,3,2,4},0.3) = 1.9; (…,0.75) = 3.25 | 1.9 and 3.25; k = 0 gives 1 and k = 1 gives 4; k = -0.1 and 1.1 Err:502; an empty cell range #VALUE! (Office: 0); text cells #VALUE!; one value 5 gives 5 |
PERCENTRANK (.249) | array, x [, significance]: the rank of x as a fraction of the set, interpolated when x is not in it; significance is the number of significant digits, 3 if omitted. #NUM! if significance < 1. MS-OI29500 2.1.1015: Office truncates significance to an integer and returns #DIV/0! for a value above 308 | PERCENTRANK({12,6,7,9,3,8},4) = 0.066; (…,5) = 0.133 | 0.0667 and 0.133: LibreOffice rounds to the digits, where the standard’s 0.066 is cut off (Office truncates). x = 8 gives 0.6, 3 gives 0 and 12 gives 1; x = 2 and 13 (outside the data) #VALUE!; significance 2 gives 0.067, 1 and 1.9 give 0.07, 0 Err:502, 20 gives the full 0.0666666666666667 and 309 gives #NUM! (Office: #DIV/0!) |
PERMUT (.250) | number, number-chosen (both truncated to integers): n!/(n−k)!. #NUM! if either is negative or number < number-chosen | PERMUT(8,2) = 56; PERMUT(10,4) = 5040; PERMUT(6,5) = 720 | 56, 5040, 720; (5,5) 120; (5,0) 1; (0,0) 1; (8.9,2.9) 56; -1, a negative number-chosen and (3,4) Err:502 |
POISSON (.254) | x, mean, cumulative-flag; x truncated; the probability mass e−λλx/x! (FALSE) or its sum from 0 to x (TRUE). #NUM! if x < 0 or mean ≤ 0. MS-OI29500 2.1.1017: Office returns #NUM! only if mean < 0, and the standard’s cumulative formula has λx where it must be λk | POISSON(2,5,TRUE) = 0.124652019; POISSON(2,5,FALSE) = 0.084224337 | 0.124652019483081 and 0.0842243374885683; (0,5,FALSE) 0.00673794699908547; x = 2.9 truncated; flags 1 and 0 as TRUE and FALSE; (150,5,TRUE) 1. x = -1, mean = -1 and mean 0 give Err:502, so LibreOffice follows the standard’s ≤ 0 and not the note’s < 0 (POISSON(0,0,FALSE) is Err:502) |
PROB (.260) | x-range, probability-range, lower-limit [, upper-limit]: the probability that a value of x-range lies between the limits, or equals lower-limit if upper-limit is omitted. #NUM! if any probability ≤ 0 (standard) or the sum is not 1; different sizes: unspecified. MS-OI29500 2.1.1023: Office returns #NUM! when the sum is not 1 (the standard says < 1) and allows probabilities ≤ 0 or > 1 | PROB({0,1,2,3},{0.2,0.3,0.1,0.4},2) = 0.1; (…,1,4) = 0.8 | 0.1 and 0.8; limits (-1,4) 1; (1,1) 0.3; (3,1) 0.8, the limits are swapped; x not in the set (2.5) 0; sum not 1 #VALUE!; a zero probability gives 0 with the sum 1 (the standard says #NUM!); probabilities {1.5,-0.2,-0.1,-0.2} with sum 1 #VALUE! (Office allows them); sizes 3 and 2 #N/A |
QUARTILE (.264) | array, result-category (truncated: 0 minimum, 1 first quartile, 2 median, 3 third quartile, 4 maximum). #NUM! if the category is below 0 or above 4; empty: unspecified | QUARTILE({1,2,4,7,8,9,10,12},1) = 3.5 | 3.5; categories 0 to 4 give 1, 3.5, 7.5, 9.25 and 12; 5 and -1 Err:502; 1.9 gives 3.5 (truncated); an empty cell #VALUE! |
RANK (.269) | number, number-list [, order] (number-list a reference; non-numeric values ignored): the rank, descending if order is 0 or omitted, ascending for any non-zero value; equal values share a rank and the next ranks are skipped. #N/A if number is not in the list. MS-OI29500 2.1.1026: Office returns #N/A in that case (the standard places no restriction) | E1:I1 = 7, 3.5, 3.5, 1, 2: the standard prints RANK(E2,E1:I1,1) = 3, the same with four arguments = 2, once more = 2 and RANK(E1,E1:I1,1) = 5. The examples are garbled (E2 is not in the list, the same call has three results, a fourth argument that is not in the syntax) | RANK(3.5,list,1) 3 and descending 2; 7 ascending 5 and descending 1; 2 ascending 2; 5 not in the list #N/A; order 7 treated as ascending; an inline array as list is accepted (3); four arguments Err:504 |
RSQ (.283) | known-ys, known-xs: the square of the Pearson coefficient. Text, logicals and empty cells in an array or reference are ignored, zeros included. Different sizes, empty or a single point: unspecified | RSQ({2,3,9,1,8,7,5},{6,5,11,7,5,4,4}) = 0.057950192 | 0.0579501915708812; one point and a constant x #DIV/0!; different sizes Err:502; F1:F4 against H1:H4 0.5714 |
SKEW (.292) | argument-list: n/((n−1)(n−2))·∑((xi−x̄)/s)3. Logicals and numbers as text typed in the list are included. Fewer than three points or a zero standard deviation: unspecified | SKEW(3,4,5,2,3,4,5,6,4,7) = 0.359543071 | 0.359543071406798, also with an inline array in the list; two values #DIV/0!; SKEW(1,2,3) 0; three equal values Err:502; SKEW(1,2,"3",9) Err:504; SKEW(1,2,4,TRUE) 1.414 (the logical counted) |
SLOPE (.294) | known-ys, known-xs: ∑(x−x̄)(y−ȳ)/∑(x−x̄)². The description of the arguments swaps “dependent” and “independent”. MS-OI29500 2.1.1041: x̄ is AVERAGE(known-xs), ȳ AVERAGE(known-ys) | SLOPE({2,3,9,1,8,7,5},{6,5,11,7,5,4,4}) = 0.305555556 | 0.305555555555556; constant x and one point #DIV/0!; different sizes Err:502; F1:F4 against H1:H4 0.4286 |
SMALL (.295) | array, k: the k-th smallest. #NUM! if k ≤ 0 or k above the count | SMALL({3,5,3,5,4;4,2,4,6,7},3) = 3; k = 7 gives 5 | 3 and 5; k = 1 gives 2 and k = 10 gives 7; k = 0, -1 and 11 #VALUE!; k = 1.9 gives 2, so k is truncated (LARGE with 1.9 gave the second largest on the previous page); text cells #VALUE!; a text k Err:504; F1:F4 with k = 1 gives 1 (TRUE counted) |
STANDARDIZE (.298) | x, mean, standard-dev: (x−μ)/σ. #NUM! if standard-dev ≤ 0 | STANDARDIZE(42,40,1.5) = 1.333333333 | 1.33333333333333; (40,40,1) 0; standard-dev 0 #DIV/0!, -1 Err:502; a text x #VALUE! |
STDEV (.299) | argument-list: the n−1 estimate. Logicals and number text typed in the list count; in an array or reference only numbers (empty cells, logicals, text and errors ignored). #DIV/0! if the size is ≤ 1 (MS-OI29500 2.1.1042 b says the standard does not specify it) | STDEV(123,134,143,173,112,109) = 23.72902583 | 23.7290258263306; STDEV(5) #DIV/0!; A1:D1 (3,10,7,10) 3.3166; four text cells #DIV/0!; STDEV(1,2,TRUE) 0.5774; STDEV(1,2,"3") Err:504; a text cell in a reference is ignored (STDEV(1,2,A2) 0.7071) |
STDEVA (.300) | argument-list: as STDEV, TRUE is 1, text and FALSE are 0; in an array or reference only values are used and empty cells and text values are ignored | STDEVA(123,134,143,173,112,109) = 23.72902583 | 23.7290258263306; STDEVA(5) #DIV/0!; four text cells 0 and STDEVA(1,3,A2) 1.5275: LibreOffice counts a text cell in a reference as 0 where the standard says it is ignored; E2:E3 (TRUE, FALSE) 0.7071; STDEVA(1,2,TRUE) 0.5774 |
STDEVP (.301) | argument-list: the n estimate for a whole population. The note on the argument says to use STDEVA for a sample; MS-OI29500 2.1.1044 b says STDEV. #DIV/0! if the size is 0 (2.1.1044 c) | STDEVP(123,134,143,173,112,109) = 21.66153785 | 21.6615378545066; STDEVP(5) 0 |
STDEVPA (.302) | argument-list: as STDEVP with the A-form rules. #DIV/0! if the size is 0 (MS-OI29500 2.1.1045) | STDEVPA(123,134,143,173,112,109) = 21.66153785 | 21.6615378545066; STDEVPA(5) 0; F1:F4 (1, “2”, TRUE, 4) gives 1.5, STDEVP 1.4142: the text “2” counted as 0 by the A form, ignored by the plain form |
STEYX (.303) | known-ys, known-xs: √(1/(n−2)·[∑(y−ȳ)² − (∑(x−x̄)(y−ȳ))²/∑(x−x̄)²]). Different sizes or fewer than three points: unspecified | STEYX({2,3,9,1,8,7,5},{6,5,11,7,5,4,4}) = 3.30571895 | 3.30571895021004; two points #VALUE!; a perfect line 0; different sizes Err:502; a constant x #DIV/0! |
TDIST (.321) | x, degrees-freedom, distribution-tails (the last two truncated): P(X > x) for 1 tail, P(|X| > x) for 2. #NUM! if degrees-freedom < 1, tails not 1 or 2, or x < 0 | TDIST(1.959999998,60,1) = 0.027322464; (…,60,2) = 0.054644927 | 0.0273224649879605 and 0.0546449299759211; x = 0 gives 0.5 and 1; x = -1, degrees 0, tails 3 and 0 Err:502; degrees 60.9 and tails 1.9 truncated (0.3213 for TDIST(1,60.9,2), 0.25 for TDIST(1,1,1.9)) |
TINV (.325) | probability, degrees-freedom: the t with a two-tailed probability. #NUM! if probability < 0 or > 1, or degrees-freedom < 1 | TINV(0.054644927,60) = 1.95999999 | 1.96000002286236; TINV(0.5,1) 1; probability 1 gives 0 (the standard allows it); probability 0 (a value of infinity in theory), -0.1, 1.1 and degrees 0 Err:502; degrees 5.9 truncated (2.5706) |
TREND (.328) | known-ys [, [known-xs] [, [new-xs] [, const-flag]]] (arrays; const-flag FALSE forces b = 0): the y-values on the least-squares line for new-xs; omitted known-xs is {1, 2, 3, …}, omitted new-xs is known-xs. Returns an array. No example | none | months 11 to 16 with the units of the GROWTH data: new months 17 and 18 give 231126.666666667 and 267572.380952381; new-xs omitted gives the fitted values (12452.380952381 at month 11); both xs omitted and the sixth value 194680.952380952; const-flag FALSE 138122.322232223 at month 11; known-xs omitted with new-xs 17 gives 595583.80952381 (x is then 1 to 6); TREND({1,9,5,7},{0,4,2,3},{5}) 11; different sizes Err:502 |
TRIMMEAN (.330) | array, percent: the mean without percent·n points, half from each tail, rounded down to an even count. #NUM! if percent < 0 or ≥ 1 (the standard says > 1; MS-OI29500 2.1.1056 says Office uses ≥ 1) | TRIMMEAN({4,6,2,5,7,8,9},0.2) = 5.857142857 | 5.85714285714286; percent 0 the same; 0.9 gives 6 (the median); 1, -0.1 and 1.1 Err:502; ten values 1 to 10 with 0.2 and 0.25 give 5.5; text cells #VALUE!; {3,10,7,10} with 0.5 gives 8.5 |
TTEST (.333) | array-1, array-2, distribution-tails, test-type (both truncated; 1 paired, 2 equal variance, 3 unequal variance; the table lists array-1 twice, the second is array-2). #NUM! if tails is not 1 or 2 or type not 1, 2 or 3 (MS-OI29500 2.1.1058 adds the type rule). Different sizes with type 1: unspecified | A2:A10 = 3, 4, 5, 8, 9, 1, 2, 4, 5 and B2:B10 = 6, 19, 3, 2, 14, 4, 5, 17, 1: TTEST(A2:A10,B2:B10,2,1) = 0.196016 | 0.196015784925282; one tail 0.0980078924626411; type 2, two tails 0.191995886760396; type 3 0.202293923368678 (one tail 0.101146961684339); tails 3 and 0, types 4 and 0 Err:502; sizes 9 and 7 with type 2 0.216967506368972; with type 1 Err:502; 2.9 and 1.9 truncated 0.196016 |
VAR (.338) | argument-list: the n−1 estimate; same argument rules as STDEV. #DIV/0! if the size is ≤ 1 (MS-OI29500 2.1.1062) | VAR(1202,1220,1323,1254,1302) = 2683.2 | 2683.2; VAR(5) #DIV/0!; F1:F4 3 (text ignored, TRUE counted); four text cells #DIV/0!; VAR(1,2,TRUE) 0.3333 |
VARA (.339) | argument-list: as VAR with the A-form rules | VARA(1202,1220,1323,1254,1302) = 2683.2 | 2683.2; VARA(5) #DIV/0!; F1:F4 3; four text cells 0; E2:E3 0.5 |
VARP (.340) | argument-list: the n variance of a whole population. #DIV/0! if the size is 0 (MS-OI29500 2.1.1064) | VARP(1202,1220,1323,1254,1302) = 2146.56 | 2146.56; VARP(5) 0; F1:F4 2; four text cells #DIV/0! |
VARPA (.341) | argument-list: as VARP with the A-form rules (MS-OI29500 2.1.1065) | VARPA(1202,1220,1323,1254,1302) = 2146.56 | 2146.56; VARPA(5) 0; F1:F4 2.25 (the text “2” counted as 0); A1:D2 (four numbers and four text cells) 18.1875 |
WEIBULL (.346) | x, alpha, beta, cumulative-flag: 1−e−(x/β)α (TRUE) or the density (α/βα)xα−1e−(x/β)α (FALSE). #NUM! if x < 0, alpha ≤ 0 or beta ≤ 0. MS-OI29500 2.1.1068: the standard names GAMMADIST in its note, it means WEIBULL | WEIBULL(105,20,100,TRUE) = 0.92958139; (…,FALSE) = 0.035588864 | 0.929581390069277 and 0.0355888640245043; WEIBULL(0,1,1,TRUE) 0, WEIBULL(0,1,1,FALSE) 1, WEIBULL(0,2,1,FALSE) 0; x = -1, alpha 0 and -1, beta 0 Err:502; a numeric flag 1 TRUE-like (0.6321); alpha 1, beta 2 FALSE 0.3033 |
ZTEST (.356) | array, test-value [, sigma]: 1 − NORMSDIST((x̄−μ0)/(sigma/√n)), s = STDEV(array) if sigma is omitted. #NUM! if sigma ≤ 0 (not in the standard’s list; MS-OI29500 2.1.1076 b adds it as Office’s rule, a maps x̄ and μ0). Empty array: unspecified. No example | none | {3,6,7,8,6,5,4,2,1,9} against 4 (a test set, not the standard’s): 0.0905741968513638; with sigma 3: 0.123125849846264; sigma 0 and -1 Err:502; {1,2,3} against 2 0.5; one value without sigma #DIV/0!, and with sigma 1 also #DIV/0!; four text cells #DIV/0!; F1:F4 with sigma 1 0.1587 |
Divergence from the standard
- Logical values in references. The standard ignores them; LibreOffice counts TRUE as 1 (PEARSON, RSQ, SLOPE, SMALL, STDEV, VAR and the others with F1:F4). Text in a reference is ignored by the plain forms but counted as 0 by the A forms in LibreOffice (STDEVA, STDEVPA, VARPA), where the standard says it is ignored in both.
- Text typed in the list.
"3"in a list is rejected with Err:504 (SKEW, STDEV) where the standard counts it. - Error values. Where the standard says #NUM! LibreOffice mostly returns
Err:502; for SMALL, PERCENTILE with an empty range, PERCENTRANK outside the data, PROB and TRIMMEAN with text it returns #VALUE! or #N/A. A file stores the error of the program that saved it. - Where the standard says #NUM! LibreOffice returns a value or a different error. PROB with a zero probability (0), STANDARDIZE with standard-dev 0 (#DIV/0!), PERCENTRANK significance above 308 (#NUM!, Office #DIV/0!), TINV at probability 1 (0).
- PERCENTRANK digits. The standard prints 0.066, LibreOffice 0.0667: it rounds where the standard (and Office) cut off.
- POISSON mean 0. Office accepts it (note 2.1.1017 a), LibreOffice does not.
- PROB. Office accepts probabilities outside 0 to 1 when they sum to 1 (note 2.1.1023 b); LibreOffice returns #VALUE!. Swapped limits are swapped back.
- RANK examples. The standard’s examples cannot be reproduced as printed; the table gives the results of its stated data.
- STDEVP note. The standard says to use STDEVA for a sample; Office says STDEV (2.1.1044 b).
- Standard text slips. SLOPE and STEYX swap dependent and independent in the argument descriptions, TTEST lists array-1 twice, the WEIBULL note names GAMMADIST, the POISSON cumulative formula uses the wrong exponent, TRIMMEAN says > 1 where Office has ≥ 1.
What the viewer does
The viewer shows the value a cell stores and never recalculates a worksheet. The conditional-format
calculator (explorer/formats/xlsx/cf.js) implements none of the 29 functions on this page; a rule
that uses one is reported as not calculated, not guessed.
See also
- Functions: statistical (GEOMEAN to NORMSINV): the previous page, with NORMSDIST, NORMSINV, LINEST and GROWTH
- Formulas: references, ranges, array formulas, error values
- Functions: math
Not described on this page
- Excel’s own results: Excel was not run, so the right-hand column is LibreOffice. The [MS-OI29500] notes 2.1.1013 to 2.1.1076 that name these functions were read (PEARSON, PERCENTILE, PERCENTRANK, POISSON, PROB, RANK, SLOPE, STDEV, STDEVA, STDEVP, STDEVPA, TRIMMEAN, TTEST, VAR, VARA, VARP, VARPA, WEIBULL, ZTEST); the other 10 have no note.
- TREND with several x variables and the exact result shape for row and column data were not tested.
- The financial functions: ACCRINT to FVSCHEDULE are on the next page.
Sources
- ECMA-376 5th edition Part 1, research/ooxml/ecma376/p1/part1.txt: PEARSON (line 86476), PERCENTILE (86523), PERCENTRANK (86541), PERMUT (86566), POISSON (86659), PROB (87146), QUARTILE (87264), RANK (87354), RSQ (87846), SKEW (88105), SLOPE (88162), SMALL (88217), STANDARDIZE (88269), STDEV to STDEVPA (88298 to 88455), STEYX (88456), TDIST (89002), TINV (89107), TREND (89154), TRIMMEAN (89209), TTEST (89257), VAR to VARPA (89390 to 89536), WEIBULL (89775), ZTEST (90530)
- [MS-OI29500] v20260818, research/ooxml/ms/MS-OI29500.txt, notes 2.1.1013 (line 19670) to 2.1.1076 (20372)
- LibreOffice, soffice headless, XLSX to CSV: samples/xlsx/oracle/statfn3/