Calculate Covariance in Excel

Your goal

You need to calculate the covariance between two numerical variables in Excel.

Step-by-step tutorial

Excel has functions for both the sample and population covariances: COVARIANCE.S and COVARIANCE.P, respectively. Here we'll calculate the sample covariance, but the approach is the same for both.

In the figure below, we measure the sample covariance between January and July precipitation. I've hidden most of the dataset columns to make it easier to see the columns we care about.

Calculating the covariance

Here's the result:

Calculating the covariance