Statistical

COVAR Formula

COVAR returns the population covariance of two data sets, measuring how they vary together. Positive covariance means both variables tend to increase together; negative means one increases while the other decreases. Unlike CORREL, covariance is in the original units multiplied together, making it harder to interpret directly but essential for portfolio theory and multivariate analysis.

Syntax

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

Examples

Stock covariance

Formula
=COVAR(B2:B253, C2:C253)
Returns the population covariance of daily returns for two stocks over one trading year. Used in portfolio variance calculations.

Height vs. weight

Formula
=COVAR(D2:D100, E2:E100)
Returns a positive covariance, indicating that taller people in the sample tend to weigh more.

Covariance matrix entry

Formula
=COVAR(A2:A50, B2:B50)
Returns one cell of a covariance matrix used in multivariate statistics.

Common Errors

#N/A

The arrays have different lengths. Both must contain the same number of data points.

#DIV/0!

One or both arrays are empty.

Tips

Use COVARIANCE.S for samples

COVAR calculates population covariance (divides by n). If your data is a sample, use COVARIANCE.S (divides by n-1).

Scale-dependent

Unlike CORREL, covariance depends on the scale of your data. Doubling all values in one array doubles the covariance. Use CORREL for a standardized measure.

Portfolio variance formula

Portfolio variance = w1^2*VAR(A) + w2^2*VAR(B) + 2*w1*w2*COVAR(A,B). Covariance is essential for diversification calculations.

Try COVAR in Viztab

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

Open Viztab

Related Formulas