COVARIANCE.S Function

Excel Functions › Statistical

Excel 2010+ Statistical

The Excel COVARIANCE.S function returns the sample covariance — the average of the products of paired deviations — measuring how two variables vary together across a sample drawn from a larger population.


Quick answer:
=COVARIANCE.S({3,2,4,5,6},{9,7,12,15,17}) sample covariance ≈ 6.5

Syntax

=COVARIANCE.S(array1, array2)
ArgumentDescription
array1RequiredThe first range or array of values.
array2RequiredThe second range or array, with the same number of values as array1. Each value is paired with the value in the same position of array1.

How to use it

COVARIANCE.S multiplies each pair's deviations from their means, sums the products, then divides by n−1 (the sample correction). A positive result means the two variables tend to rise together; a negative result means one rises as the other falls.

=COVARIANCE.S({3,2,4,5,6},{9,7,12,15,17}) // ≈ 6.5

The only difference from COVARIANCE.P is the divisor: the .S version divides by n−1 (use it when your data is a sample), while .P divides by n (use it when the data is the entire population). For the same data, COVARIANCE.S is always the larger of the two.

Both arrays must contain the same number of numeric values. Text, logical values, and empty cells in a paired position are ignored.

Tip: Covariance is scale-dependent, so its raw size is hard to interpret. To get a unitless −1 to +1 measure of how tightly the variables move together, use CORREL instead.

Try it: interactive demo

Live demo

Enter two comma-separated lists of equal length to see the sample covariance.

Result:

Practice workbook

📊
Download the free COVARIANCE.S practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

What is the difference between COVARIANCE.S and COVARIANCE.P?
COVARIANCE.S divides the sum of paired deviation products by n−1 and is for sample data; COVARIANCE.P divides by n and is for an entire population. For the same numbers, the .S result is always slightly larger.
Should I use covariance or correlation?
Covariance tells you the direction of the relationship but its magnitude depends on the units. CORREL normalizes covariance to a −1 to +1 scale, so it is far easier to interpret the strength of the relationship.
Do the two arrays have to be the same size?
Yes. If array1 and array2 hold different numbers of data points, COVARIANCE.S returns the #N/A error. Each value is paired by position.
Is COVARIANCE.S available in older Excel versions?
COVARIANCE.S was introduced in Excel 2010. In Excel 2007 and earlier only the legacy COVAR function exists, and it computes the population covariance (the equivalent of COVARIANCE.P).

Master functions like this in one day

This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related functions: COVARIANCE.P · CORREL · PEARSON · VAR.S · STDEV.S · SLOPE