How to calculate covariance in Excel?

In this Excel tutorial, you will learn how to calculate covariance in Excel.

We can detect the existence of a correlation relationship by examining the covariance.

Covariance is the average of the products of the deviations of each data point pair.

Use covariance to define the relationship between two datasets.

  • A positive value of covariance occurs when both examined characteristics are moving in the same direction.
  • Negative covariance occurs when the increase in the value of one feature tends to decrease the value of the other.
  • It is also possible that the covariance is zero. This means that the variables are not correlated with each other.

Sample Covariance

To calculate sample covariance use the COVARIANCE.S Excel function.



In the given example sample covariance formula is =COVARIANCE.S(A2:A10,B2:B10)

Excel Sample Covariance

Population Covariance

To calculate population covariance use the COVARIANCE.P Excel function.



In the given example sample covariance formula is =COVARIANCE.P(A2:A10,B2:B10)

Excel Covariance Population

In most cases, you will use sample covariance. Use covariance of population function only when it is specifically said that it is population covariance.

Using the Data analysis tool

Using functions to enumerate the covariance is effective. I prefer to use the data analysis tool for covariance calculation. It is also a convenient way to calculate the covariance of a data table. Excel will prepare a covariance report based on the values ​​you provide.

To use the data analysis tool, you must have the data analysis toolpak installed. Here you will find a course on how to install the data analysis toolpak in Excel.

To calculate the covariance with the data analysis tool, first go to the Excel ribbon. Click the Date tab. On the right side you will find the Data Analysis button.

Data Analysis Covariance

A window will appear. Select Covariance from the menu.

In the next window, determine the input range. Covariance input is your entire data table. If you also select the row with headings, then check the Labels in the first row option.

Covariance input output

Select the place where you want the result as the output range. If you have free space on the worksheet, enter the cell address. Otherwise, check New Worksheet Ply.

The covariance report has appeared in the position you selected as output in the previous window.

Covariance descriptive statistics report

Download covariance calculator here.

Further reading:
How to calculate variance?
How to calculate correlation?
How to calculate accuracy?
How to calculate Standard Deviation?
How to calculate t value?