ONLYOFFICE COVAR: Population-Style Covariance and Paired Examples
Rebuild ONLYOFFICE COVAR from complete paired observations, distinguish population and sample divisors, and compare units and the official example.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: =COVAR(A2:A6,B2:B6) has an independently expected result of 1.2 for the five paired observations below. COVAR uses the population-style divisor n in the checked implementation; a sample calculation with nā1 gives 1.5 instead.
Availability and version history
- Introduced: The first introduction release and date are not established by the checked sources.
- Availability: Currently documented in ONLYOFFICE’s rolling function help; no final supported-version endpoint is established.
- Scope: Shared Spreadsheet Editor documentation, with the calculation divisor corroborated by an explicitly pinned official source-code revision. Individual client/build parity is unverified.
- Checked: October 14, 2026, against the official COVAR reference, source and vendor screenshot. Example outputs were independently calculated; these cases were not tested in the native application.
Syntax and what the name means here
=COVAR(array1, array2)
Both ranges are required. The official help requires equal numbers of elements and says text, logical values and empty cells are ignored while numeric zeros are included.
That short entry does not spell out the divisor. The official SDKJS implementation at commit 72b0421 divides the centered cross-product sum by the number of numeric pairs. The calculation also reproduces the vendor screenshot. This establishes the basis of the examples without claiming that this source commit identifies every deployed Desktop, Docs or mobile build.
ONLYOFFICE currently documents COVAR alongside COVARIANCE.P and COVARIANCE.S. The checked sources do not announce COVAR’s retirement. Keep the chosen population or sample interpretation explicit rather than deciding from a name alone.
Rebuild the covariance from five pairs
Create a blank sheet named CovarPairs. Put x, y, x deviation, y deviation and Product in A1:E1. Enter:
| Row | A: x | B: y |
|---|---|---|
| 2 | 1 | 2 |
| 3 | 2 | 4 |
| 4 | 3 | 5 |
| 5 | 4 | 4 |
| 6 | 5 | 5 |
Use G for labels. Put =AVERAGE(A2:A6) in H2 and =AVERAGE(B2:B6) in H3; expect 3 and 4. Enter =A2-$H$2 in C2, =B2-$H$3 in D2 and =C2*D2 in E2. Fill C2:E2 through row 6.
| Row | Expected C | Expected D | Expected E |
|---|---|---|---|
| 2 | -2 | -2 | 4 |
| 3 | -1 | 0 | 0 |
| 4 | 0 | 1 | 0 |
| 5 | 1 | 0 | 0 |
| 6 | 2 | 1 | 2 |
Enter =SUM(E2:E6) in H5; expect 6. Put =H5/5 in H6 and =COVAR(A2:A6,B2:B6) in H7; both mathematical targets are 1.2. The 5 is the count of complete numeric pairs, not the number of columns or a count including the header.
Compare the three covariance names
Keep the source data unchanged. Use:
| Cell | Formula | Expected result |
|---|---|---|
| H8 | =COVARIANCE.P(A2:A6,B2:B6) |
1.2 |
| H9 | =COVARIANCE.S(A2:A6,B2:B6) |
1.5 |
| H10 | =COVAR(B2:B6,A2:A6) |
1.2 |
The sample result is 6/(5ā1), not evidence of a mismatch in the input data. Swapping the two variables preserves covariance for these complete numeric pairs. That symmetry differs from a regression slope, whose units and value depend on which variable is predicted.
Advanced: units change the magnitude
Put Rescaled x and Shifted y in J1:K1. Enter =A2*100 in J2 and =B2+50 in K2; fill J2:K2 through row 6. Enter =COVAR(J2:J6,B2:B6) in N2 and =COVAR(A2:A6,K2:K6) in N3.
Expected results are 120 and 1.2. Multiplying one variable by 100 multiplies covariance by 100; adding 50 leaves centered deviations unchanged. Covariance therefore has combined x-unit Ć y-unit dimensions and is not bounded between -1 and 1.
For a direction control, put =-B2 in M2 and fill to M6. Enter =COVAR(A2:A6,M2:M6) in N4; expect -1.2. Negating one variable reverses the sign. A positive value indicates positive average co-movement in this data, not proof of causation.
Reproduce the official screenshot
On another blank sheet named VendorCovar, enter 12,65,178,45,98 in A1:E1 and 45,78,34,90,147 in A2:E2, without headers. Put =COVAR(A1:E1,A2:E2) in G2.
The screenshot displays -248.88, matching the independent calculation. The means are 79.6 and 78.8; the centered cross-product sum is -1244.4, and dividing by five gives -248.88. Dividing the same numerator by four would instead give -311.1, the sample result.
Errors, missing pairs and related functions
Keep the same number and order of observations in both ranges. Do not sort one variable alone. The inspected source selects numeric pairs at corresponding positions; do not independently delete text from one column and shift the remaining values upward.
The short help does not define every exact error or mixed-type edge case, and this guide does not claim native execution of them. Use complete numeric pairs for the worksheet above, retain genuine zeros, and investigate missing observations before interpreting the result.
COVARIANCE.P makes the population interpretation explicit. COVARIANCE.S uses the sample divisor. CORREL normalizes co-movement by the two variables’ spreads; it answers a different question from raw covariance.