What Is COVARIANCE.S Excel Function?

The COVARIANCE.S Excel function is used to calculate the covariance between two datasets or arrays in Excel. Covariance measures the relationship between two sets of variables and indicates whether they tend to move in the same direction, called positive covariance, or in opposite directions, called negative covariance. Investors use covariance to understand the relationship between two stock returns and predict how they might perform in the future. By analyzing historical returns, investors can see if stocks tend to move together or in opposite directions.

The example below shows how to calculate the covariance of numbers in a range. We have two sets of values, and we calculate the covariance using the COVARIANCE.S function in Excel. The formula to calculate the output is =COVARIANCE.S(A2:A9, B2:B9) inserted in cell D2. You get a result of 11.714, as shown below.

Key Takeaways
  • The COVARIANCE.S Excel function specifically calculates the sample covariance, which is a measure of how much two variables change together based on a sample of data points.
  • The syntax used to calculate covariance is =COVARIANCE.S(Array1, Array2)
  • This function is commonly used in statistical analysis, financial modeling, and data analysis to quantify the relationship between different variables and assess their linear dependency.
  • The COVARIANCE.S Excel function, professionals can better understand the correlation between datasets and make informed decisions based on this statistical measure.


  1. Array1 – (Mandatory) This is the first cell range of integers.
  2. Array2 – (Mandatory) This is the second cell range of integers.

The covariance is the relationship between two variables, with a positive value indicating that an increase in one variable results in an increase in the other and a negative value indicating the inverse.

This function can be used to identify potential diversification opportunities or correlations within a dataset.

COVARINCE.S Excel function indicates the sample covariance where the range of values represent a sample of values whereas COVARIANCE.P calculates the covariance of an entire population.

How To Use COVARIANCE.S Function in Excel?

To utilize the COVARIANCE.S function in Excel, follow the steps outlined below.

#1 – Access from the Excel ribbon

  1. To display the answer, select the cell to enter the formula. Next, navigate to the Formulas tab and click on it.


  2. Click the More Functions option in the Excel ribbon.


  3. Click on “Statistical” in the drop-down menu. Next, select “COVARIANCE.S” from the list of options provided.


  4. Enter the required values in the Function Arguments window, and then click OK to proceed.


#2 – Enter the worksheet manually

Step 1: Start by selecting an empty cell and entering the formula =COVARIANCE.S(. Alternatively, you can start typing =C and then double-click on the COVARIANCE.S function from the Excel suggestions.

COVARIANCE.S Excel-Step-2-1

Step 2: Enter the required arguments, then press Enter after closing the braces to see the results. 

COVARIANCE.S Excel-Step-2-2


Example #1

In this example, let us study the COVARIANCE.S Excel function by analyzing the share prices of Ron’s company and John’s company over 12 months. Our goal is to calculate the covariance between the shares of these two companies. Take a look at the table for the values required for this calculation.


To use the COVARIANCE.S Excel function, just follow these simple steps:

Step 1: Type the following formula into cell E2:


COVARIANCE.S Excel-Example-1-Step-1

Step 2: Press Enter. You get a value of $7,63,173.17 in cell E2, as shown in the image below.

COVARIANCE.S Excel-Example-1-Step-2

When you compare the share prices of the two companies using the COVARIANCE.S Excel function, you can learn a lot about how their returns are related. This function calculates the covariance between the monthly share prices of the two companies. If the covariance is positive, it means that the share prices usually move in the same direction.

Thus, these two stocks show high potential returns for an investor looking to invest in them and have a substantial potential loss as well.

Example #2

To better understand the COVARIANCE.S function between two different stocks – one from a shoe company and the other from a bags company – we are calculating the covariance of the stocks that Mr. Thomas invested in for six months. Check out the values in the table provided.


Step 1: To start calculating, choose cell E2 and enter the formula. Type in the COVARIANCE.S formula in the specified cell:


COVARIANCE.S Excel-Example-2-Step-1

Step 2: The value will then be displayed in cell E2 as the covariance value of the two companies.

COVARIANCE.S Excel-Example-2-Step-2

When you use the COVARIANCE.S Excel function to calculate the covariance of two stocks, you can learn a lot about how they’re related. The covariance value shows how one stock’s returns change in comparison to another stock’s returns. If the covariance is positive, it means that when one stock’s return goes up, the other stock’s return also goes up. On the other hand, if the covariance is negative, it means there’s an inverse relationship between the two stocks.

The negative covariance investment is for those who choose to invest in a risk-averse way as the decline in the price of one stock is mitigated by an increase in the other.

Example #3

Let’s take a closer look at the example of the COVARIANCE.S function by comparing the number of goals scored in two sports by some students: Football and Hockey. Our objective is to determine the covariance between the goals scored in the two sports. It will help us determine if the students are good at both sports. Check out the table below for the required values.


To use the COVARIANCE.S Excel function, just follow these easy steps:

Step 1: Enter the formula below in cell E2.


Step 2: The result shows up in cell E2, just like in the image below.

COVARIANCE.S Excel-Example-3-Step-2

When you compare the goals scored between the two sports using the COVARIANCE.S Excel function, you can observe a negative covariance, meaning, when students are good at one sport, their performance is decreasing in the other.

Now, the institute can look up for ways to improve the students’ performance in both sports.

Important Things To Note

  1. The #N/A error in COVARIANCE.S happens when two arrays have different lengths.
  2. The “#VALUE! error” occurs when one of the arrays being used is empty.
  3. The #DIV/0! error occurs when one of the arrays is empty or contains only one data point.
  4. Using covariance, investors can select stocks that work well together to reduce risk and increase returns in their portfolio.

Frequently Asked Questions (FAQs)

1. What are the benefits of using the COVARIANCE.S function?

The benefits of using the COVARIANCE.S function are:

• We can calculate the covariance between two sets of data, which measures the relationship between the variables and indicates how they move in relation to each other.
• The COVARIANCE.S function can help identify potential trends or patterns in data that may not be immediately apparent, leading to more accurate forecasting and strategic planning. 

2. What are the limitations of using the COVARIANCE.S Excel function?

The limitations of using the COVARIANCE.S Excel function are;

• The function only measures linear relationships between variables, meaning that it may not capture more complex or non-linear relationships accurately.
• The COVARIANCE.S Excel function can be greatly affected by outliers in the data, leading to potentially misleading results.
• The COVARIANCE.S Excel function does not provide any information about the strength or direction of the relationship between variables, which can limit its usefulness in interpreting the data.
• The COVARIANCE.S Excel function requires a strong understanding of statistical concepts and assumptions.

3. Are there any alternatives or similar functions to consider instead of using the COVARIANCE.S Excel function?

When considering alternatives to using COVARIANCE.S, one option that is used is the CORRELATION function. The CORRELATION function provides a standardized measure of the relationship between two sets of data, ranging from -1 to 1. This function, unlike the COVARIANCE.S function, normalizes the values and eliminates the units of measurement, making it easier to interpret and compare across different datasets. Another one is the COVARIANCE.S function, is uses the VARIANCE function in conjunction with other statistical measures such as standard deviation and regression analysis. 

Download Template

This article must help us understand the COVARIANCE.S Excel Function’s formula and examples. You can download the template here to use it instantly.

Guide to COVARIANCE.S Excel Function. Here we explain how to use COVARIANCE.S function with examples & downloadable excel template. You can learn more from the following articles. –

Reader Interactions

Leave a Reply

Your email address will not be published. Required fields are marked *