Excel - COVAR Function
COVAR Function
The Excel Covariance function comprises two independent arrays and predicts how these variables are changed together. This function retrieves the covariance, to verify whether high variation between two datasets existed or not. For example, analysts identify whether high sales of goods make more productivity.
The COVAR function in Excel 2013 has been interchanged with the COVARIANCE.P function in Excel 2010.
Syntax
The syntax of COVAR function is as follows −
COVAR (array1, array2)
Arguments
You can use the following arguments with the COVAR function −
| Argument | Description | Required / Optional |
|---|---|---|
| Array1 | It specifies the integers range. | Required |
| Array2 | It contains a set of integer values. | Required |
Points to Note
- The arguments comprise integer values, arrays, named ranges, or references that consist of numbers.
- The arrays values or reference argument containing text, logical values, or empty cells are ignored. However, cells with a zero value are included.
- If array1 and array2 have different numbers of data points, COVAR returns the #N/A error value. The number of field values should be the same.
- If any arrays are empty, COVAR returns the #VALUE! error value.
- More than two arguments are prohibited in this function.
- COVAR.P and COVAR.S functions are distinct versions of COVAR functions.
- COVAR.P retrieves the covariance relying on the population whereas COVAR.S retrieves the sample covariance.
Examples of COVAR Function
Practice the following examples to learn the use of the COVAR function in Excel.
Example 1
If both arrays contain integer values and have same dimension.
Solution
Consider the sample dataset where integer values are specified in the range B4 to C9 cells. Enter the formula =COVAR(B4:B9, C4:C9) in the C10 cell and press Enter to obtain the resulting value.
Note − Ensure the same number of data points should be specified in both arrays.
Example 2
The arrays values or reference argument containing text, logical values, or empty cells are ignored. However, cells with a zero value are included.
Solution
Consider the sample datasets where arrays comprise the mixed values like zero, text and empty and numeric values.
Enter the formula "=COVAR(C3:C10, D3:D10)" in the D13 cell and press Enter.
Example 3
If array1 and array2 have different numbers of data points, COVAR returns the #N/A error value.
Solution
Consider the two arrays {65,78,89} and {45} whose number of data points is different in them. You may enter the function =COVAR({65,78,89},{4.5}) in the desired cell and press "Enter". Here, the number of elements in these arrays is different.
Therefore, #N/A error is retrieved as the dissimilar number of data values defined in the two arrays.
Example 4
If any arrays are empty, COVAR returns the #VALUE! error value.
Solution
You may write the formula "=COVAR(,{43,65})" in the "D16" cell and press Enter to get the result.