COVARIANCE.S Function (Gnumeric)
Calculate sample covariance with COVARIANCE.S in Gnumeric. Includes paired data, ignored-row behavior, the n−1 divisor and verified error examples.
Verification status: 18 reference, boundary and advanced-check formulas were recalculated with Gnumeric 1.12.57 ssconvert. Retained identities and results were checked against independent calculations. Gnumeric 1.12.62 was source-checked only. How formula examples are checked
Quick answer: =COVARIANCE.S(F2:F4,G2:G4) gives 5 in the tested Gnumeric 1.12.57 build.
Availability and version history
- Introduced: Gnumeric 1.11.3 release notes explicitly record its addition.
- Supported in: Gnumeric 1.12.62; no retirement is established.
- Scope: Desktop Gnumeric with its Statistics plugin. English comma-separated formulas are shown.
- Checked: October 14, 2026. The tables and named advanced check use 1.12.57 ssconvert. Current 1.12.62 source was inspected; that release was not executed.
What COVARIANCE.S returns
COVARIANCE.S returns sample covariance: Σ(xᵢ−x̄)(yᵢ−ȳ)/(m−1), where m is the number of retained numeric pairs. A positive result indicates positive joint variation in this dataset; a negative result indicates opposite variation. Covariance is measured in the product of the two variables’ units and is not bounded by −1 and 1. Versioned function help.
Syntax and arguments
=COVARIANCE.S(array1,array2)
array1 and array2 are required, correspondingly ordered datasets. The original collections must have matching lengths. Positions containing text, logical values or blanks in either input are excluded as pairs; the remaining numeric values are not independently shifted together.
Reproducible examples
Enter these values with the stated storage types. F5, G5, H7 and L3 are genuinely empty; do not type an empty string into them.
| Row | F: X | G: Y | H: mixed | I: reverse X | J: constant | K: text gap | L: blank gap | M: logical gap | N: negative |
|---|---|---|---|---|---|---|---|---|---|
| 2 | 2 | 3 | number 2 | 6 | 5 | 3 | 3 | logical TRUE | −2 |
| 3 | 4 | 7 | logical TRUE | 4 | 5 | text skip |
empty | 7 | −4 |
| 4 | 6 | 8 | logical FALSE | 2 | 5 | 8 | 8 | 8 | −6 |
| 5 | empty | empty | text 8 |
||||||
| 6 | text pending |
||||||||
| 7 | empty |
| Formula | Gnumeric 1.12.57 result |
|---|---|
=COVARIANCE.S(F2:F4,G2:G4) |
5 |
=COVARIANCE.S(F2:F4,I2:I4) |
-4 |
=COVARIANCE.S(F2:F4,F2:F4) |
4 |
=COVARIANCE.S(F2:F4,J2:J4) |
0 |
=COVARIANCE.S(F2:F3,G2:G3) |
4 |
=COVARIANCE.S(F2:F4,K2:K4) |
10 |
=COVARIANCE.S(F2:F4,L2:L4) |
10 |
=COVARIANCE.S(F2:F4,M2:M4) |
1 |
Practical worksheet
For F2:F4=2,4,6 and G2:G4=3,7,8, the means are 4 and 6. Cross-products are (−2)(−3)=6, 0×1=0 and 2×2=4. Their sum is 10; dividing by m−1=2 gives 5, matching the native result. Dividing by m=3 would instead give the population covariance 10/3.
Each row must describe the same observation in both columns. Sorting only one column can change the answer while leaving the formula syntactically valid. A covariance alone does not establish causation or a predictive model.
Advanced interpretation and checks
The missing-row examples deliberately use the same first dataset. K2:K4=3,“skip”,8 excludes the middle pair, leaving (2,3) and (6,8). Their sample covariance is 10. L has a blank at the same position and also gives 10. M2:M4=TRUE,7,8 excludes the first pair and gives 1 from (4,7),(6,8).
The native advanced symmetry check subtracts the covariance with its arguments reversed and returns zero. Independently, sample covariance of X with itself equals its sample variance: F2:F4 gives 4. A constant second dataset J2:J4 gives zero covariance, without requiring every first-column value to be equal.
Version-specific source comparison
The retained 1.12.57 and 1.12.62 worksheet callbacks have the same relevant argument guards and calculation dispatch. That source comparison does not establish execution or universal floating-point equivalence in the later build.
Boundaries and troubleshooting
Fewer than two retained pairs and unequal original lengths produce #VALUE! in the tested build. Source errors propagate, as the explicit division-by-zero example shows. The help’s worked-example prose uses COVAR, a population function; it must not be reused unchanged for COVARIANCE.S. The examples here use the correct sample divisor m−1.
F5 is an actually empty cell. Errors below are the tested build’s results, not zero-valued mathematical answers.
| Formula | Gnumeric 1.12.57 result |
|---|---|
=COVARIANCE.S(F2,G2) |
#VALUE! |
=COVARIANCE.S(F5,F5) |
#VALUE! |
=COVARIANCE.S(F2:F4,G2:G3) |
#VALUE! |
=COVARIANCE.S(F2:F5,G2:G5) |
5 |
=COVARIANCE.S(H3:H4,G2:G3) |
#VALUE! |
=COVARIANCE.S(H5:H6,G2:G3) |
#VALUE! |
=COVARIANCE.S(F2:F4) |
#N/A |
=COVARIANCE.S(F2:F4,G2:G4,1) |
#N/A |
=COVARIANCE.S(1/0,G2) |
#DIV/0! |
Official evidence and checking scope
- Current worksheet implementation
- Tested-version worksheet implementation
- Current paired-position collection
- Current sample covariance calculation
The retained workbook’s stale SUM cache and uncached SUM both recalculated correctly. Formula identities, typed inputs and native results were inspected. The importer reported unsupported style-extension elements; that warning is retained, and no all-formatting claim is made. GUI entry, other locales and later-release output were not tested.