COVAR Function in Calligra Sheets: Population Covariance
Calculate population covariance of paired numeric ranges in Calligra Sheets with COVAR. Check correlation, matching shapes, and sample versus population denominators.
Verification status: Official documentation referenced; example outcomes independently reasoned or arithmetically checked where stated. Not executed in Calligra Sheets. How formula examples are checked
Quick answer: COVAR(range1;range2) measures how two sets of paired numeric observations vary together. The examined Calligra 26.08.2 implementation divides the sum of paired centered products by the number of observations n, so it is a population covariance calculation, not a sample covariance dividing by nā1. For x=1,2,3,4,5 and y=3,5,7,9,11, independently expected =COVAR(A2:A6;B2:B6) is 4. [K1āK4, I1]
Evidence boundary (2026-10-13): The KDE handbook, 26.08.2 registration, helper and implementation have been examined. Tables report independently calculated expectations; no native Calligra execution, spreadsheet screenshot or import/export test was performed. [K1āK5, I1]
Exact syntax, arguments and calculation
=COVAR(range1; range2)
=COVAR(A2:A6; B2:B6)
| Position | Argument | Requirement | Meaning |
|---|---|---|---|
| 1 | range1 |
Required | Numeric observations for variable X, supplied as a range/array. |
| 2 | range2 |
Required | Correspondingly ordered numeric observations for variable Y. |
The KDE function handbook specifically describes two cell ranges; the C++ registration calls setParamCount(2) and setAcceptArray(). There are exactly two required arguments, no optional sample/population setting, and no default ranges. Its func_covar wrapper calls avg(range1), avg(range2), counts accepted values, checks for equal nonzero counts, computes paired centered products and divides by number. [K1āK3]
The helper func_covar_helper also compares row and column shapes, not merely the total number of numeric values; differently shaped arrays produce an internal error value in the inspected source. This is more precise than guessing from Excel’s UI messages. Exact installed Calligra-visible error labels and mixed-type behaviors are still unverified. [K4]
Mathematically, paired (xi,yi) with means xĢ and ȳ:
population covariance = SUM((xi - xĢ) * (yi - ȳ)) / n
sample covariance = SUM((xi - xĢ) * (yi - ȳ)) / (n - 1)
Sign interpretation: positive covariance indicates a tendency to rise together; negative indicates movement in opposite directions; zero indicates no linear covariance in the particular data. It does not prove independence or causation. Magnitude depends on the two variables’ units and scales; CORREL/PEARSON are unitless comparisons instead. [K1, I1]
Reproducible five-pair worksheet
- In a blank Calligra Sheets sheet enter A1 = X, B1 = Y (rising), C1 = Y (falling) and D1 = Y+100.
- Type the numeric values below into A2:D6. Keep every row paired: the first X belongs to first Y, and so on. There are five observations in each column.
- Enter formulas in H2:H14 and the helper in E2:E6. Check printed expectations only as independent arithmetic, not as observed Calligra results. [I1]
| Row | A ā X | B ā Y rising | C ā Y falling | D ā Y+100 |
|---|---|---|---|---|
| 2 | 1 | 3 | 11 | 103 |
| 3 | 2 | 5 | 9 | 105 |
| 4 | 3 | 7 | 7 | 107 |
| 5 | 4 | 9 | 5 | 109 |
| 6 | 5 | 11 | 3 | 111 |
| Enter in | Formula | Independently expected output | Interpretation |
|---|---|---|---|
| H2 | =COVAR(A2:A6;B2:B6) |
4 | Population covariance of rising paired values. |
| H3 | =COVAR(A2:A6;C2:C6) |
ā4 | Falling paired values produce negative covariance. |
| H4 | =COVAR(A2:A6;A2:A6) |
2 | Covariance of X with itself = population variance of X. |
| H5 | =VARP(A2:A6) |
2 | Independent population-variance control. |
| H6 | =COVAR(B2:B6;A2:A6) |
4 | Covariance is symmetric for these numeric pairs. |
| H7 | =COVAR(A2:A6;D2:D6) |
4 | Adding a constant to Y leaves covariance unchanged. |
| H8 | =AVERAGE(A2:A6) |
3 | Mean X. |
| H9 | =AVERAGE(B2:B6) |
7 | Mean Y. |
| H10 | =COUNT(A2:A6) |
5 | Population observation count. |
| H11 | =CORREL(A2:A6;B2:B6) |
1 | Perfect positive linear relationship for these numbers. |
| H12 | =SUM(E2:E6) |
20 | Numerator of covariance. |
| H13 | =H12/H10 |
4 | Population covariance independently calculated. |
| H14 | =H12/(H10-1) |
5 | Sample covariance comparison, not what COVAR computes. |
In E1 type Centered pair product. In E2 enter:
=(A2-$H$8)*(B2-$H$9)
Copy through E6. The independent E2:E6 results are 8, 2, 0, 2, 8, totaling 20; dividing by 5 yields 4. Both mean cell references are absolute so that copying preserves the correct mean. [I1]
Advanced use 1 ā distinguish covariance from correlation
For the rising data, =COVAR(A2:A6;B2:B6) ā 4, whereas =CORREL(A2:A6;B2:B6) ā 1. Covariance depends on the measurement scales: multiplying every Y by 10 would make the numerical covariance 40, while the mathematical correlation would still be 1 for these exact nonconstant observations. The independent identity is:
COVAR(X;Y) = CORREL(X;Y) * STDEVP(X) * STDEVP(Y)
This identity requires both standard deviations positive and pairs valid. For A2:A6, population SD is sqrt(2); for B2:B6 it is sqrt(8), so their product is 4. [K3, I1]
Advanced use 2 ā compare two different response directions
Treat B2:B6 as a rising response and C2:C6 as a falling response while X increases. COVAR(A;B) ā +4 and COVAR(A;C) ā ā4. This gives a directional summary, not a slope or a strength on a fixed universal scale. If you need a slope of Y on X with this data, the independently derived quantity is COVAR(X;Y)/VARP(X) = 4/2 = 2. The statement is mathematical; a native test of the formula on a worksheet was not conducted. [I1]
Use paired differences and validated numeric ranges for any real-world dataset. If a row is missing a measurement in one variable, do not shift the other column upward, because this silently changes the correspondence of observations. [I1]
Advanced use 3 ā sample covariance without inventing a Calligra function
For five numeric pairs, the independent sample covariance is 5, not 4. Calculate it with the visible pair-products helper: =SUM(E2:E6)/(COUNT(A2:A6)-1) ā 5. This formula is a transparent manual alternative for the specific valid numeric data. It is not a claim that a separate COVARIANCE.S function is installed or that COVAR can be made into a sample estimator by a third argument. [K2, I1]
Errors, range compatibility, and unresolved native behavior
| Scenario | Source-level rule or independent reasoning | Recommended native test |
|---|---|---|
| Empty second range / unequal numeric counts | func_covar checks `number2<=0 |
|
| Same count but different shapes | Helper checks rows != rows2 and cols != cols2 and returns internal error. |
Compare a vertical 5Ć1 range with a horizontal 1Ć5 range. [K4] |
| First range empty | The second-range positive-count check and count-equality guard reject two empty counted ranges before division. | Test two empty ranges natively; do not invent exact visible error. [K3] |
| Non-numeric cells or errors | Numeric count and array arithmetic are visible in source, but handling of mismatched missing pairs and coercion is not established for the installed app. | Run a careful aligned mixed-type matrix. [K3, K4] |
| Constant X or constant Y | Mathematically covariance is zero for constant finite numeric data, though CORREL involves division by zero in that situation. |
Test against source to establish visible return. [I1] |
| Sample result expected | COVAR divides by n, not nā1. |
Verify whether the task asks for population or sample covariance. [K3] |
| Huge magnitude or decimal precision | The statistical calculation may be sensitive to numerical representation; no benchmark was run. | Independently audit with high precision and real installation. |
| Formula shown as text / invalid separator | KDE English syntax uses ;; real installed locale/parser may differ. |
Check leading = and local language settings. [K1] |
| Wrong sign | Values must be paired by original row; sort or edit both columns together. | Manually inspect correspondence. [I1] |
The inspected C++ helper iterates paired elements at the same array coordinates and subtracts their respective means. This supports the intended pairing requirement in source; it does not certify formula import behavior, particular visible errors or full edge-case handling in a native build. [K4]
Compatibility with Excel and release limitations
Excel also documents COVAR as a legacy population-covariance function and recommends newer Excel names COVARIANCE.P and COVARIANCE.S. Calligra’s inspected registration establishes COVAR, but does not establish support for those dotted Excel names. Excel’s documented #N/A/#DIV/0! distinctions must never be reported as Calligra application-visible errors without direct testing. For plain numeric matched arrays, the population covariance arithmetic agrees. [K2āK4, M1, I1]
Version pinned: KDE Gear 26.08.2 (announced 2026-10-08) and Calligra source commit 72123cc643f6625351139e7df294544255a1056f. KDE Calligra currently highlights Linux distro packages/Flatpak and says Windows support is in progress. Source catalogue presence is not an execution guarantee for every edition, platform or installed package. No native testing performed. [K2, K5]
Related links ā checked against official KDE documentation
Claim-level references ā checked 2026-10-13
- [K1] KDE Sheets handbook:
COVAR(range1; range2), purpose and paired range types: https://docs.kde.org/stable_kf6/en/calligra/sheets/functions.html#COVAR. - [K2] KDE 26.08.2 registration: exactly two array-accepting arguments, distinct COVAR function: https://github.com/KDE/calligra/blob/72123cc643f6625351139e7df294544255a1056f/sheets/functions/statistical.cpp#L153-L165.
- [K3] Pinned
func_covarimplementation: mean calculations, numeric counts, error condition and divide by n: https://github.com/KDE/calligra/blob/72123cc643f6625351139e7df294544255a1056f/sheets/functions/statistical.cpp#L1066-L1088. - [K4] Pinned
func_covar_helper: array-shape check and paired centered products: https://github.com/KDE/calligra/blob/72123cc643f6625351139e7df294544255a1056f/sheets/functions/statistical.cpp#L451-L478. - [K5] Release and platform evidence: 26.08.2 announcement 2026-10-08, Calligra download page: https://kde.org/announcements/gear/26.08.2/ Ā· https://calligra.org/download/.
- [K6] KDE pinned statistical XML: help entry COVAR and two range argument descriptions: https://github.com/KDE/calligra/blob/72123cc643f6625351139e7df294544255a1056f/sheets/functions/statistical.xml.
- [M1] Microsoft Excel COVAR: comparison only, modern Excel names and Excel-specific errors: https://support.microsoft.com/en-us/excel/functions/covar-function.
- [I1] Independent calculation (2026-10-13): arithmetic pairing audit and Python
statistics.covariance(X,Y) * (nā1)/nplus direct means/centered products, as well asstatistics.pvariancefor COVAR(X;X); not native Calligra execution.