COVARIANCE.S in Google Sheets: Sample Covariance and Paired-Row Checks
Use Google Sheets sample covariance with a visible n-minus-one denominator, preserved pairing and independently checked duplication and scaling examples.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: COVARIANCE.S(data_y,data_x) estimates covariance when the supplied paired records are treated as a sample. Its independent numeric model divides centered paired products by n minus one, rather than the population count n.
Availability and version history
- Introduced: first introduction date is not established by the reviewed official history; no desktop release number is inferred.
- Availability: documented in the rolling Google Sheets service; this guide uses the web worksheet workflow.
- Checked: October 14, 2026; official COVARIANCE.S reference. Documentation and independent calculations, with no native Sheets execution or wider client certification.
Syntax and a source-example caution
=COVARIANCE.S(data_y,data_x)
Both arguments are series, and corresponding positions must represent the same observation. Google describes them as dependent and independent data and says encountered text is ignored. The worked examples below use equally sized, fully numeric columns.
The official page contains generic sample formulas with one argument or several separate scalars, which do not consistently match its formal two-argument signature. Follow the stated signature and the page’s worked two-array examples. This guide does not treat the inconsistent sample snippets as additional supported call forms.
The published two-array example returning 4.65 is consistent with the sample n-minus-one convention. Native mixed-type pairing and invalid-shape error details remain unverified.
Example 1: inspect a four-pair sample
Enter A1:B5:
| X | Y |
|---|---|
| 1 | 2 |
| 2 | 1 |
| 3 | 4 |
| 4 | 3 |
=COVARIANCE.S(B2:B5,A2:A5)
Expected result: 1. Both means are 2.5. The four centered paired products are 0.75,0.75,0.75,0.75. Their sum is 3, and the sample denominator is 4-1=3.
The same records under the population convention give 0.75 with COVAR. For this fixture, sample covariance is 4/3 of population covariance. That ratio depends on the included pair count; it is not a universal fixed correction.
Example 2: a small sample with a different center
Enter X 2,4,6 in D2:D4 and Y 1,5,3 in E2:E4:
=COVARIANCE.S(E2:E4,D2:D4)
Expected result: 2. The means are 4 and 3. The paired products are 4,0,0, totaling 4, and the denominator is two. The population comparison would be 4/3.
Individual observations can lie above or below their means in several combinations. A positive covariance does not require every successive Y value to increase when X increases.
Advanced example: duplicated rows change the sample result
Duplicate the original four complete pairs below themselves. There are now eight pairs with the same two means. The centered-product total doubles to 6, but the sample denominator becomes seven:
=COVARIANCE.S(B2:B9,A2:A9)
Expected result: 6/7, approximately 0.857143, rather than the original 1. The sample denominator did not simply double from three to six.
This check can reveal a duplicated join or copied records. A larger row count is not evidence of more independent information. Preserve the observation identifier as well as both numeric variables.
Advanced example: transformation and pairing controls
Using the original four pairs, multiplying Y by ten gives covariance 10. Adding 7 to every Y instead leaves it at 1. Negating Y gives -1. These changes follow directly from centered products and help distinguish a unit conversion from a shifted measurement origin.
Sorting both columns together in reverse row order leaves the result 1. Sorting only Y into 1,2,3,4 creates new pairings and gives sample covariance 5/3, approximately 1.666667. The changed answer is not a sorting optimization; it describes different records.
For an explicit helper check, calculate both means in separate cells, compute each row’s product of deviations and sum those products. Divide by the number of included complete pairs minus one. This helper is a numeric audit of the supplied fixture, not an undocumented rule for filtering incomplete data.
Meaning, units and boundaries
Covariance has the product of the two input units. It is not bounded to -1 through 1. PEARSON instead normalizes linear association; the original four pairs give 0.6 there.
A constant X series 5,5,5,5 paired with the original Y has covariance 0 in the independent model because all X deviations vanish. That is distinct from an insufficient sample: fewer than two complete pairs leaves no positive sample denominator. The exact native error displays for insufficient observations, mismatched arrays and mixed errors are not established here and are not borrowed from Excel.
References and verification
Examples use fictional data, English function names and comma argument separators. Expected results are independent calculations or explicitly documented rules, not native Sheets captures. Check spreadsheet locale when reproducing punctuation-sensitive formulas.