COVARIANCE.S Function
Returns the sample covariance of two sets of numbers.
Category
Statistical
Available in
Excel 2010+, Microsoft 365
Returns
A number
Overview
Covariance shows whether two sets of numbers move in the same direction: positive when they rise together, negative when one rises as the other falls, near 0 when there's no pattern.
Its size depends on the units (here, $k × $k), so it's hard to read on its own — CORREL rescales it to −1…1. Covariance is used inside formulas for regression and portfolio risk.
COVARIANCE.S treats the data as a sample and divides by n − 1. Use COVARIANCE.P when the pairs are the entire population.
Syntax
Arguments
| Argument | Required? | What it does |
|---|---|---|
| array1 | Yes | The first range of numbers. |
| array2 | Yes | The second range, the same size as array1. |
Examples
Example 1 — Ad spend and sales
Eight months treated as a sample of Northstar's advertising results.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Month | Ad spend ($k) | Sales ($k) | Measure | Result |
| 2 | Jan | 2 | 21 | Sample | 16.43 |
| 3 | Feb | 3 | 25 | Population | 14.375 |
| 4 | Mar | 5 | 33 | ||
| 5 | Apr | 4 | 28 | ||
| 6 | May | 6 | 38 | ||
| 7 | Jun | 7 | 40 | ||
| 8 | Jul | 8 | 46 | ||
| 9 | Aug | 5 | 31 |
Positive: higher spend goes with higher sales.
Example 2 — Slope from covariance
A regression slope is the covariance divided by the variance of x.
Returns about 4.107 — the same as SLOPE(C2:C9,B2:B9).
Common mistakes
- #DIV/0! There are fewer than two pairs of numbers.
- #N/A The ranges are different sizes.
Notes
- Related functions: COVARIANCE.P, CORREL, VAR.S, SLOPE.

Author
Kyle Stott
Certified Microsoft Excel Expert
Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.