The COVARIANCE.P function in Excel is a statistical tool used to measure the degree to which two variables change together. This function calculates the population covariance between two datasets, allowing users to analyze the relationship between them. A higher covariance indicates that the variables tend to increase or decrease together, while a lower covariance suggests that the relationship is weaker.
Syntax
COVARIANCE.P(array1, array2)
- array1: The first array or range of data points.
- array2: The second array or range of data points associated with the first.
Example #1
COVARIANCE.P(A1:A10, B1:B10)
This function calculates the population covariance between the values in range A1 to A10 and B1 to B10. If the values are 2, 4, 6 in A1:A3 and 3, 6, 9 in B1:B3, the result would be 6.0.
Example #2
COVARIANCE.P({10, 20, 30}, {5, 15, 25})
Here, the function computes the covariance for two arrays directly entered into the function. The covariance would yield a result of 50.0, indicating a positive relationship between the sets.
Example #3
COVARIANCE.P(B1:B4, C1:C4)
Assuming values in B1 to B4 are 1, 3, 5, 7 and values in C1 to C4 are 2, 4, 6, 8, this function would compute a covariance of 10.0, suggesting that as values in B increase, so do values in C.
Error handling
- N/A: Occurs when one array is empty or has non-numeric data.
- VALUE!: This error arises if the two arrays are of different sizes.
- DIV/0!: Although rare, this error may indicate that variance is zero, often seen when all values in an array are the same.