COVARIANCE.S
Returns sample covariance for two paired numeric data sets.
COVARIANCE.S measures joint variability using n - 1 in the denominator.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=COVARIANCE.S(array1, array2)
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
array1 | number (range) | Required | — |
array2 | number (range) | Required | — |
Remarks
- Arrays must contain paired numeric values with matching lengths.
- Requires at least two paired points.
- Pairing and shape mismatches return spreadsheet errors from paired-array validation.
Error cases
- Returns
#DIV/0!when fewer than two numeric pairs are available.
Examples
Evaluate matched observations in two equally sized arrays.
Formula =COVARIANCE.S({1,2,3,4},{1,4,5,7})
Expected result 3.16666666666667
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Reverse the second series to compare opposite movement.
Formula =COVARIANCE.S({1,2,3,4},{7,5,4,1})
Expected result -3.16666666666667
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Use two observations that follow a perfect positive linear pattern.
Formula =COVARIANCE.S({1,2},{2,4})
Expected result 1
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Each observation needs a partner in the other array.
Formula =COVARIANCE.S({1,2,3,4},{1,4,5})
Expected result #N/A
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Positive sample covariance
Formula =COVARIANCE.S({1,3,5},{2,4,6})
Expected result 4
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Negative sample covariance
Formula =COVARIANCE.S({1,2,3},{3,2,1})
Expected result -1
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.