Do two variables move together? Covariance measures the direction of their joint variation — positive when they rise together, negative when one falls as the other rises. COVAR computes it directly.
The example
Ad spend vs sales — they rise together, so covariance is positive.
| A | B | C | |
|---|---|---|---|
| 1 | Week | Ad $ | Sales |
| 2 | 1 | 10 | 42 |
| 3 | 2 | 14 | 55 |
| 4 | 3 | 9 | 40 |
| 5 | Covariance | + | positive |
The formula
Covariance of the two columns:
How it works
Covariance averages how the two variables deviate together:
- For each pair, it multiplies how far each value is from its own mean, then averages those products.
- A positive result means when one variable is above its mean, the other tends to be too. A negative result means they move oppositely.
- The magnitude depends on the units, so covariance alone is hard to interpret — it’s the sign that’s most readable.
COVAR(andCOVARIANCE.P) use the population formula;COVARIANCE.S(365/2010+) uses the sample formula.
Want a comparable number? Divide covariance by the product of the two standard deviations and you get correlation — a unit-free −1 to +1 score. CORREL does it directly and is usually easier to interpret than raw covariance.
Try it: interactive demo
Enter pairs as “x,y”, one per line.
Variations
Sample covariance
Divides by n−1:
Correlation instead
Unit-free −1 to +1:
As a percentage of variance
R-squared:
Pitfalls & errors
Magnitude is unit-dependent. Covariance in dollars×units isn’t comparable across datasets — use correlation for that. Read covariance mainly for its sign.
Equal-length ranges. The two ranges must have the same number of paired values, or you get a #N/A.
Correlation ≠ causation. A positive covariance shows association, not that one variable causes the other.
Practice workbook
Frequently asked questions
How do I calculate covariance in Excel?
What's the difference between covariance and correlation?
Why do I get a #N/A error?
Stop fighting formulas. Learn them in a day.
This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class