How to calculate covariance in excel?

How to calculate covariance in excel?

Covariance is essential in statistical analysis, particularly when analyzing relationships between variables. This article discusses the complexities of calculating covariance in Excel, offering practical instructions and illustrations.

What is Covariance?

Covariance is the measure of how two variables move together. A positive covariance suggests a direct relationship, while a negative one implies an inverse association. Excel offers efficient tools for calculating covariance.

How to calculate Covariance in Excel?

Excel offers two main formulas for covariance: COVARIANCE.P and COVARIANCE.S–the first for population data, the second for sample data. Let’s explore each in detail.

Covariance formula in Excel for population:

=COVARIANCE.P(array1, array2)

Covariance formula in Excel for Sample:

=COVARIANCE.S(array1, array2)

Example 1: Basic Covariance Calculation

Step 1: Open Excel and Input Data

Start by opening Microsoft Excel and inputting the datasets you want to calculate covariance. For this example, we’ll use the following data:

Consider two datasets:

Dataset 1: 3, 6, 7, 8, 11

Dataset 2: 5, 4, 3, 2, 8

Place these values in columns A and B.

Step 2: Calculate Covariance for Population Data

Use the COVARIANCE.P formula to calculate covariance for population data.


Press enter, and you will get the covariance 2 for population data.

Step 3: Calculate Covariance for Sample Data

Now, let’s use the COVARIANCE.S formula for sample data.


Press Enter. The result should represent the covariance for the sample datasets.

Parameter vs Statistic: Unpacking the Key Differences Know which is best and most precise in data analysis between

Example 1: Basic Covariance Calculation

How to calculate covariance in excel?
How to calculate covariance in excel?
How to calculate covariance in excel?

Real-world Applications

From now on, we will provide five word problems to demonstrate the practical application of covariance.

Problem 1: Finance
The covariance between firms A and B stock prices is what you want to evaluate to improve your portfolio.

Problem 2: Economics
The concept of covariance is widely used in economic studies for analyzing the dynamics between household income and spending patterns.

Problem 3: Climate Science
Researchers use covariance to study the correlation between temperature and rainfall patterns over the years.
Problem 4: Medicine
Covariance analysis allows us to compare patient demographics and treatment results in medical research.

Problem 5: Marketing
Covariance is important in marketing analytics to determine how advertising spending influences product sales.

Practice Problems

Practice Problem 1:

Dataset 1: 10, 15, 20, 25, 30
Dataset 2: 5, 10, 15, 20, 25

Practice Problem 2:

Dataset 1: 2, 4, 6, 8, 10
Dataset 2: 1, 3, 5, 7, 9

Practice Problem 3:

Dataset 1: -2, -1, 0, 1, 2
Dataset 2: 3, 5, 7, 9, 11

Practice Problem 4:

Dataset 1: 7, 8, 10, 12, 15
Dataset 2: 20, 18, 15, 12, 10

Practice Problem 5:

Dataset 1: 1, 2, 3, 4, 5
Dataset 2: 10, 9, 8, 7, 6

Practice Problem 6:

Dataset 1: -5, -3, 0, 2, 5
Dataset 2: 2, 5, 8, 11, 14

Practice Problem 7:

Dataset 1: -5, -3, 0, 2, 5
Dataset 2: 2, 5, 8, 11, 14

Practice Problem 8:

Dataset 1: 12, 15, 18, 21, 24
Dataset 2: -4, -3, -2, -1, 0

Practice Problem 9:

Dataset 1: -10, -8, -6, -4, -2
Dataset 2: 7, 5, 3, 1, -1

Practice Problem 10:

Dataset 1: 3, 6, 9, 12, 15

Dataset 2: 2, 4, 6, 8, 10

Interpreting Covariance Results

It is also important to interpret the result after calculating covariance for each practice problem. Covariance, in its turn also becomes rather complicated for interpretation unless more details are provided. Here’s a brief guide on understanding the outcomes:

Positive Covariance:
Shows a positive correlation between variables.
One variable tends to increase when the other increases.
Negative Covariance:
Indicates that variables have a negative correlation.
As it increases, the other variable tends to decrease.
Zero Covariance:
It means that there is no linear relationship between the variables.
Variation of one variable does not imply variation in another.

Practical Tips for Covariance Analysis

Combine with Correlation:
Covariance does not have unitless standards; therefore, comparing it across different datasets is difficult. An alternative approach could be to implement correlation and covariance for standardization.
Understand Limitations:
Covariance only captures linear relationships. Non-linear relationships may not be captured fully.
Consider Data Scaling:
Scaling datasets’ advantages include limiting the effects caused by different units, resulting in better covariance results.
Use Visualizations:
Visualize the relationship between variables and verify covariance outcomes through scatter plots.


However, acquiring the ability to calculate covariance in Excel is very useful for data analysis. It is vital to interpret the covariance results so that you can derive pertinent insights from your data sets. Use the practice problems below to interpret results and apply these learnings to working with actual data sets.

You can practice calculating covariance in Excel for each problem and analyzing the implications of results to get a better understanding of variable relationships.


A: Yes, a negative covariance shows that there is an inverse relationship between the variables so one increases while the other decreases.

A: Covariance is necessary to clarify the interrelations of two variables. It assists in recognizing patterns, relationships and dependencies between datasets for informed decision making.

A: Using the entire dataset, use COVARIANCE.P for population data. If you have a sample of data where the whole population is unavailable, use COVARIANCE.S.

A: Covariance does not predict the results but gives insights into the correlation between variables. For making predictions, additional statistical analyses are required.

Do you want to get a more interesting blog? Just click down and read more interesting blogs.

Stay tuned with our latest math posts