WorksheetFunction.Covar method (Excel)

Returns covariance, the average of the products of deviations for each data point pair.

Important

This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality.

For more information about the new functions, see the Covariance_P and Covariance_S methods.

Syntax

expression.Covar (Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name Required/Optional Data type Description
Arg1 Required Variant The first cell range of integers.
Arg2 Required Variant The second cell range of integers.

Return value

Double

Remarks

Use covariance to determine the relationship between two data sets. For example, you can examine whether greater income accompanies greater levels of education.

The arguments must either be numbers or be names, arrays, or references that contain numbers.

If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

If Arg1 and Arg2 have different numbers of data points, Covar generates an error.

If either Arg1 or Arg2 is empty, Covar generates an error.

The covariance is as follows, where x and y are the sample means AVERAGE(array1) and AVERAGE(array2), and n is the sample size:

Formula

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.