Excel COVARIANCE.P Function

What is COVARIANCE.P function in Excel?


The COVARIANCE.P function is one of the Statistical functions of Excel.

It returns population covariance, the average of the products of deviations for
each data point pair in two data sets.

We can find this function in Statistical of insert function Tab.

How to use COVARIANCE.P function in excel

  1. Click on an empty cell (like F5).
 an empty cell in excel

2. Click on the fx icon (or press shift+F3).

fx icon in excel

3. In the insert function tab you will see all functions.

function list in excel

4. Select STATISTICAL category.

5. Select COVARIANCE.P function.

6. Then select ok.

excel COVARIANCE.P function

7. In the function arguments Tab you will see COVARIANCE.P function.

8. Array1 is the first cell range of integers and must be numbers, arrays, or
references that contain numbers.

9. Array2 is the second cell range of integers and must be numbers, arrays, or
references that contain numbers.

10. You will see the results in the formula result section.

Examples of COVARIANCE.P function in Excel

here are 10 examples of the COVARIANCE.P function in Excel:

  1. Calculate the covariance between two sets of data: =COVARIANCE.P(A1:A10,B1:B10)
  2. Find the covariance between two ranges on different sheets: =COVARIANCE.P(Sheet1!A1:A10,Sheet2!B1:B10)
  3. Calculate the covariance between two arrays: =COVARIANCE.P({1,2,3,4},{2,4,6,8})
  4. Find the covariance between two columns of a table: =COVARIANCE.P(Table1[Column1],Table1[Column2])
  5. Calculate the covariance between two named ranges: =COVARIANCE.P(Data_Set1,Data_Set2)
  6. Find the covariance between two dynamic ranges using OFFSET function: =COVARIANCE.P(OFFSET(A1,,,COUNT(A:A)),OFFSET(B1,,,COUNT(B:B)))
  7. Calculate the covariance between two ranges based on a condition: =COVARIANCE.P(IF(C1:C10=”x”,A1:A10,B1:B10),IF(C1:C10=”x”,B1:B10,A1:A10))
  8. Find the covariance between two filtered ranges: =COVARIANCE.P(SUBTOTAL(9,OFFSET(A1,ROW(A1:A10)-ROW(A1),)),SUBTOTAL(9,OFFSET(B1,ROW(B1:B10)-ROW(B1),)))
  9. Calculate the covariance between two ranges excluding any errors: =COVARIANCE.P(IFERROR(A1:A10),IFERROR(B1:B10))
  10. Find the covariance between two ranges with missing values: =COVARIANCE.P(A1:A10,B1:B10) – (AVERAGE(A1:A10)*AVERAGE(B1:B10))

What the COVARIANCE.P Function Does

The COVARIANCE.P function calculates the covariance of a set of values in Excel.

This function is used to determine the degree to which two variables are linearly related and how they change together.

It provides information on both the direction and magnitude of the relationship between the two variables.

Difference Between COVARIANCE.P and COVARIANCE.S

The COVARIANCE.P function and the COVARIANCE.S function are used to calculate the covariance of a dataset, but there is a difference between them.

The COVARIANCE.P function assumes that the dataset is a sample of a larger population, whereas the COVARIANCE.S function assumes that the dataset represents the entire population.

This means that the COVARIANCE.P function divides the sum of squared deviations by the number of observations minus 1 (n-1), while the COVARIANCE.S function divides it by the total number of observations (n).

Arguments for the COVARIANCE.P Function

There are two arguments required for the COVARIANCE.P function: the range of cells containing the first variable and the range of cells containing the second variable. These can be either individual cells or ranges of cells.

For example, suppose we have two sets of data, A1 through A10 and B1 through B10. We could use the formula “=COVARIANCE.P(A1:A10,B1:B10)” to calculate the covariance between these two sets.

How to Enter the COVARIANCE.P Function into an Excel Cell

To enter the COVARIANCE.P function into an Excel cell, follow these steps:

  1. Click on the cell where you want to display the result.
  2. Type an equal sign (=) to begin the formula.
  3. Type “COVARIANCE.P” to specify the function you want to use.
  4. Open a set of parentheses, then enter the range of cells containing the first variable.
  5. Enter a comma (,), then enter the range of cells containing the second variable.
  6. Close the parentheses and press Enter to calculate the covariance.

For example, if you wanted to calculate the covariance between A1:A10 and B1:B10, you would enter “=COVARIANCE.P(A1:A10,B1:B10)” in the target cell.

Handling Multiple Data Sets in the COVARIANCE.P Function

The COVARIANCE.P function in Excel can handle multiple data sets. You just need to specify each range of cells containing the variables separated by commas within the parentheses.

For example, suppose we have three sets of data: A1 through A10, B1 through B10, and C1 through C10. We could use the formula “=COVARIANCE.P(A1:A10,B1:B10,C1:C10)” to calculate the covariance between these three sets.

The Order of Data Sets in the COVARIANCE.P Function

The order of the data sets does matter when using the COVARIANCE.P function in Excel. The first set of data represents the first variable, and the second set of data represents the second variable.

For example, if we want to calculate the covariance between A1 through A10 and B1 through B10, we would use the formula “=COVARIANCE.P(A1:A10,B1:B10)”. If we were to switch the order of the data sets, the result would be different.

Handling Empty Cells or Missing Values in the COVARIANCE.P Function

If there are empty cells or missing values in the ranges of cells provided for the COVARIANCE.P function, Excel will ignore them and calculate the covariance based on the remaining values.

For example, suppose we have two sets of data with 10 observations each, but one of the cells in the first set is empty.

The formula “=COVARIANCE.P(A1:A10,B1:B10)” would still provide a result based on the remaining 9 observations.

Using Non-numeric Data with the COVARIANCE.P Function

The COVARIANCE.P function in Excel only works with numeric data. If you try to use non-numeric data, Excel will display an error message.

For example, if we have data in cells A1 through A10 that contains text or symbols, the formula “=COVARIANCE.P(A1:A10,B1:B10)” would result in an error.

We would need to remove the non-numeric data from the range of cells before calculating the covariance.

Interpreting the Result of the COVARIANCE.P Function

The result of the COVARIANCE.P function in Excel represents the degree to which two variables are linearly related and how they change together.

The value can be positive or negative, and its magnitude indicates the strength of the relationship. A higher absolute value would indicate a stronger relationship.

For example, suppose we have two sets of data: A1 through A10 and B1 through B10. We could use the formula “=COVARIANCE.P(A1:A10,B1:B10)” to calculate the covariance between these two sets.

If the result equals 100, this means that the two sets are positively related and the strength of the relationship is strong.

Conversely, if the result equals -50, this means that the two sets are negatively related and the strength of the relationship is moderate.

Calculating Covariance Between Two Specific Cells

Technically, you cannot use the COVARIANCE.P function to calculate the covariance between two specific cells. This is because the function requires ranges of cells as arguments.

However, you could simply input a range that contains only two cells to achieve this result.

For example, suppose that you want to calculate the covariance between cell A1 and cell B1 in Excel.

To do this, you could use the formula “=COVARIANCE.P(A1:B1)” which would include both cells in the range and allow you to calculate the covariance between them.

Effect of Outliers on the COVARIANCE.P Function

The COVARIANCE.P function in Excel is affected by outliers in the data set. Outliers are data points that are significantly different from the majority of the observations.

They can have a large impact on the covariance value, depending on their magnitude and direction relative to the other data points.

For example, let’s say that we have a set of data representing the number of hours studied and the corresponding exam scores.

If one student in the class studied for an unusually long amount of time and scored significantly higher than the rest of the class, this could potentially skew the covariance value between the two sets of data.

Range of Values Returned by the COVARIANCE.P Function

The range of values returned by the COVARIANCE.P function in Excel is theoretically infinite. The value can be positive or negative, and it has no upper or lower limit.

It all depends on the data being analyzed.

For example, if we were looking at data for the height and weight of a population, the covariance value could range from very small (indicating little correlation) to very large (indicating strong correlation).

If the covariance value was 500, this would indicate a strong positive relationship between height and weight.

Conversely, if the covariance value was -200, this would indicate a moderate negative relationship between the two variables.

Using the COVARIANCE.P Function in a Larger Formula or Calculation

You can use the results of the COVARIANCE.P function in Excel in larger formulas and calculations.

For example, you could use the covariance value to calculate the slope and intercept of a regression line, which can help predict future outcomes based on past data.

For instance, if we have two sets of data A1 through A10 and B1 through B10, we can use the COVARIANCE.P function to calculate the covariance between them.

We can then use this covariance value to calculate the slope of the regression line, which represents the amount of change in B based on a unit change in A.

Calculating the Covariance Matrix for a Group of Variables

Yes, you can use the COVARIANCE.P function in Excel to calculate the covariance matrix for a group of variables.

The covariance matrix is a square matrix that displays the variances and covariances among all pairs of variables in the dataset.

It is often used in multivariate analysis to identify patterns and relationships among multiple variables.

To calculate the covariance matrix using the COVARIANCE.P function in Excel, you would need to specify each range of cells containing the variables separated by commas within the parentheses for each pair of variables.

For example, suppose we have three sets of data: A1 through A10, B1 through B10, and C1 through C10.

We could use the formula “=COVARIANCE.P(A1:A10,B1:B10), COVARIANCE.P(A1:A10,C1:C10), COVARIANCE.P(B1:B10,C1:C10)” to calculate the covariance matrix for these three sets.

Limitations of Using the COVARIANCE.P Function in Excel

There are some limitations to using the COVARIANCE.P function in Excel. One limitation is that it assumes a linear relationship between the two variables being analyzed.

In reality, some relationships may be non-linear and require a different type of analysis.

Additionally, the COVARIANCE.P function can be affected by outliers in the data set, as mentioned before, which could potentially skew the results.

Accuracy of the COVARIANCE.P Function in Excel

The accuracy of the COVARIANCE.P function in Excel depends on the quality of the data being analyzed and any outliers present in the dataset.

If the data is well-behaved and follows an approximately linear relationship, the covariance value provided by the function should be accurate.

However, if there are outliers or non-linear patterns in the data, the accuracy of the result may be compromised.

Using the COVARIANCE.P Function with Non-linear Data

The COVARIANCE.P function in Excel is designed to work with linear data only. If the data being analyzed contains non-linear patterns or relationships, it may not be appropriate to use the COVARIANCE.P function.

In such cases, it would be better to use other statistical methods that are more suitable for non-linear data.

For example, if we have data representing the relationship between temperature and ice cream sales, there may be a non-linear pattern where sales increase at a decreasing rate as temperature increases.

In this case, the COVARIANCE.P function would not be appropriate, and a different type of analysis such as polynomial regression or correlation ratio analysis would be more appropriate.

Visualizing the Results of the COVARIANCE.P Function in Excel

There are various ways to visualize the results of the COVARIANCE.P function in Excel.

One way is to create a scatter plot of the two variables being analyzed with the covariance value displayed on the chart. This can help identify any patterns or relationships between the variables.

Another way to visualize the results is to use conditional formatting in Excel to highlight cells containing high or low covariance values.

This can help identify outliers and other anomalies in the data set.

Using the COVARIANCE.P Function for Trend Analysis or Forecasting

The COVARIANCE.P function in Excel can be used for trend analysis or forecasting to some extent.

By calculating the covariance between two sets of data over time, it is possible to determine whether they are moving in the same direction or opposite directions.

However, it is important to note that the COVARIANCE.P function assumes a linear relationship between the two variables being analyzed, which may not always hold true in real-world scenarios.

For example, if we have two sets of data representing the sales of two products over time, we could use the COVARIANCE.P function to determine whether they are moving in the same direction or opposite directions.

If the result of the function is positive, this would indicate that the two products are moving in the same direction over time, whereas a negative result would indicate that they are moving in opposite directions.

Comparing the Results of the COVARIANCE.P Function with Other Statistical Measures of Correlation in Excel

In Excel, there are several other statistical measures of correlation that can be used in addition to the COVARIANCE.P function, such as Pearson’s correlation coefficient and Spearman’s rank correlation coefficient.

These measures provide additional information on the strength and direction of the relationship between two variables.

To compare the results of the COVARIANCE.P function with other statistical measures of correlation in Excel, you could calculate both measures for the same set of data and compare the results.

This can help identify any discrepancies or outliers in the dataset and provide a more complete picture of the relationship between the variables being analyzed.


COVARIANCE.P related functions 

  • Use COVARIANCE.S function to returns sample covariance, the average of the products of deviations for each data point pair in two data sets.

Leave a Reply

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