Statistical functions
COVARIANCE.S
Matches all 6 recorded answers
Recorded: 6 workbook cells. How we measure this · See the Rust code
Local names in 40 languages
| Language | Name in Excel |
|---|---|
| Arabic | COVARIANCE.S |
| Bulgarian | COVARIANCE.S |
| Czech | COVARIANCE.S |
| Danish | KOVARIANS.S |
| German | COVARIANCE.S |
| Greek | COVARIANCE.S |
| English (Australia) | COVARIANCE.S |
| English (United Kingdom) | COVARIANCE.S |
| English (United States) | COVARIANCE.S |
| Spanish | COVARIANZA.M |
| Estonian | COVARIANCE.S |
| Finnish | KOVARIANSSI.S |
| French | COVARIANCE.STANDARD |
| Hebrew | COVARIANCE.S |
| Croatian | COVARIANCE.S |
| Hungarian | KOVARIANCIA.M |
| Indonesian | COVARIANCE.S |
| Italian | COVARIANCE.S |
| Japanese | COVARIANCE.S |
| Korean | COVARIANCE.S |
| Lithuanian | COVARIANCE.S |
| Latvian | COVARIANCE.S |
| Norwegian | KOVARIANS.S |
| Dutch | COVARIANTIE.S |
| Polish | KOWARIANCJA.PRÓBKI |
| Portuguese (Brazil) | COVARIÂNCIA.S |
| Portuguese (Portugal) | COVARIÂNCIA.S |
| Romanian | COVARIANCE.S |
| Russian | КОВАРИАЦИЯ.В |
| Slovak | COVARIANCE.S |
| Slovenian | COVARIANCE.S |
| Serbian (Latin) | COVARIANCE.S |
| Swedish | KOVARIANS.S |
| Thai | COVARIANCE.S |
| Turkish | KOVARYANS.S |
| Ukrainian | COVARIANCE.S |
| Vietnamese | COVARIANCE.S |
| Chinese (Simplified) | COVARIANCE.S |
| Chinese (Hong Kong) | COVARIANCE.S |
| Chinese (Traditional) | COVARIANCE.S |
Names from Microsoft's support site.
What it does
COVARIANCE.S(array1, array2)
COVARIANCE.S(array1, array2) measures sample covariance: whether paired observations tend to move in the same direction. It averages products of deviations using divisor n-1. Covariance carries the product of the two input units.
Try it
=COVARIANCE.S({1,2,3},{2,4,6}) returns 2. The means are two and four; the paired deviation products are two, zero and two.
With an excluded position, =COVARIANCE.S({1,"missing",3},{2,4,6}) returns 4 under the current paired collection rule. The second position is skipped on both sides; the remaining pairs are (1,2) and (3,6).
Quirks
The original arguments need the same number of cells; otherwise the current collector returns #N/A. It flattens them in traversal order and preserves positional alignment. If either side of a position is text, logical or blank, that position supplies no pair. Numeric zero still participates. Worksheet errors are read and propagated rather than silently removed with a nonnumeric partner.
An empty set, or only one eligible pair, gives #DIV/0! for sample covariance. Do not filter each side independently and zip the remaining lists: that can pair observations that never belonged together.
How to implement
The current paired collector checks equal original cell counts, then walks both arguments together and retains only positions where both values are numeric. It checks the first argument’s value before the second’s at each position. This admission step belongs before either mean is calculated.
- Let
nbe the number of retained pairs. Apply the empty-set and sample-count checks above. - Accumulate separate binary64 sums
SxandSy, then storemx=Sx/nandmy=Sy/n. - Starting from
C=0, visit each retained pair and add the ordinary binary64 product(x-mx)*(y-my). - Return
C/n-1. The current helper uses ordinary binary64 operations here; no stored-stage identification for the whole Excel route is claimed.
For the excluded-position example, the retained means are two and four. Products (-1)*(-2) and 1*2 total four. Divide by one to obtain sample covariance four. The count is two, not the three original positions.
Covariance retains both input scales: multiplying every y by ten multiplies the mathematical covariance by ten. CORREL normalizes that scale away. The exact-arithmetic relation does not certify the last bits of either implementation.
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.
COVARIANCE.S · 3 lines · calc-func/src/catalogue/statistics.rs on GitHub37 covariance_s "COVARIANCE.S" (2, 2) [R "array1", R "array2"] |s, a, sv| {
out(s, paired::covariance_from_pairs(&pairs(s, a, 0, 1, PairScalars::SkipNonnumeric, sv)?, CovarianceDivisor::Sample))
}
Kernels shared with other functions
meansported/paired_stats_commoncovariance_from_pairsported/paired_stats_common
Argument and result plumbing
No implementation has been published with a Handbook test suite for this function.
Version differences
No same-input comparison between named Excel builds is recorded for this function here. The documented behaviour below is not a measurement of every Excel release.
Alternatives
CORREL removes units and scales to a correlation coefficient. COVARIANCE.P changes the denominator.
Named variants
No named variants are recorded yet.
Suggest a correction or contribute an implementation · For agents