Statistical

COVARIANCE.S Formula

COVARIANCE.S returns the sample covariance of two data sets, dividing by n-1. Use it when your data is a sample from a larger population, which is the typical case in business and research. The n-1 denominator corrects for the bias inherent in sample estimates.

Syntax

COVARIANCE.S(array1, array2)
ParameterDescription
array1 Parameter of the COVARIANCE.S function.
array2 Parameter of the COVARIANCE.S function.
Try COVARIANCE.S in Viztab — free, no signup

Examples

Sample asset covariance

Formula
=COVARIANCE.S(B2:B100, C2:C100)
Returns the sample covariance of two assets' returns from 99 sampled trading days.

Survey data

Formula
=COVARIANCE.S(D2:D500, E2:E500)
Measures the covariance between two survey questions across 499 respondents (a sample of the population).

Compared to population covariance

Formula
=COVARIANCE.S(A2:A20, B2:B20) > COVARIANCE.P(A2:A20, B2:B20)
Returns TRUE — sample covariance (dividing by 19) is always larger in absolute value than population covariance (dividing by 20) for the same data.

Common Errors

#N/A

The two arrays have different lengths.

#DIV/0!

Fewer than 2 data pairs. Sample covariance requires at least 2 paired observations.

Tips

Default choice for most analyses

Unless you have complete population data, COVARIANCE.S is the statistically correct choice. Most business data is sampled.

Difference from COVARIANCE.P

COVARIANCE.S divides by n-1, COVARIANCE.P by n. For large samples (n > 30), the difference becomes negligible.

Building a covariance matrix

For portfolio analysis with multiple assets, compute COVARIANCE.S for each pair to build a covariance matrix. This matrix is the core input for mean-variance optimization.

Try COVARIANCE.S in Viztab

Import your data and use COVARIANCE.S with 370+ other formulas. No signup required.

Open Viztab

Related Formulas