COVARIANCE.S calculates the sample covariance between two sets of numbers, showing whether they tend to move together or in opposite directions. It divides the sum of paired deviations by n-1, making it suitable when your data is a sample of a larger population.
=COVARIANCE.S(array1, array2)What does COVARIANCE.S do?
COVARIANCE.S is a statistical function that measures how two variables change together. If higher values in one column tend to appear alongside higher values in another, the covariance is positive; if one rises while the other falls, it is negative. Unlike correlation, covariance is not standardised, so its size depends on the units of your data.
The ".S" stands for sample. Excel also has COVARIANCE.P for population data. Use COVARIANCE.S when your rows are a sample drawn from a larger group — which is the usual situation in business reporting, classroom datasets, and survey analysis. Getting the right version matters because the two functions divide by different denominators and therefore return slightly different numbers.
A practical case: you have monthly advertising spend and sales for a sample of regions. COVARIANCE.S tells you whether spend and sales move in the same direction, giving you a quick signal before you build a regression or a correlation matrix. It is a building block for deeper analysis and a simple way to sanity-check relationships in a spreadsheet.
When to use COVARIANCE.S
- Checking whether two sample columns move together before running regression.
- Comparing advertising spend and sales across a sample of regions.
- Analysing study hours and exam scores for a class sample.
- Reviewing temperature and energy usage readings from a sample of days.
- Testing whether customer wait time and satisfaction scores vary together.
- Exploring paired survey responses where only a sample was collected.
COVARIANCE.S syntax
=COVARIANCE.S(array1, array2)| Argument | Required? | What to enter |
|---|---|---|
array1 | Required | The first range or array of numbers. It must contain at least two numeric values and have the same number of values as array2. Example: B2:B10. |
array2 | Required | The second range or array of numbers, paired row by row with array1. It must have the same count of numeric values as array1. Example: C2:C10. |
What it returns: A single number: the sample covariance of the paired values. Positive means the two variables tend to move in the same direction; negative means they tend to move in opposite directions; near zero means little linear relationship.
COVARIANCE.S examples
1 Example 1: Two short columns of paired numbers
This is the simplest case: five paired observations in columns A and B. The goal is to see whether the two variables move together. COVARIANCE.S(B2:B6,C2:C6) pairs each row, finds how far each value sits from its own column mean, multiplies those paired deviations, adds them up, and divides by n-1 (four). The result is positive, so the variables tend to rise together.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Observation | Variable X | Variable Y | |||
| 2 | 1 | 2 | 5 | 10 | ||
| 3 | 2 | 4 | 7 | |||
| 4 | 3 | 6 | 9 | |||
| 5 | 4 | 8 | 11 | |||
| 6 | 5 | 10 | 13 | |||
| 7 |
2 Example 2: Study hours and exam scores
A teacher has a sample of six students with study hours and exam scores. The goal is to measure whether more study hours are associated with higher scores. COVARIANCE.S(B2:B7,C2:C7) computes the paired deviations from each column's mean, multiplies them, sums the products, and divides by five. The positive result suggests that students who study more tend to score higher.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Student | Study Hours | Exam Score | |||
| 2 | Ana | 2 | 55 | 31.4 | ||
| 3 | Ben | 3 | 60 | |||
| 4 | Cara | 5 | 68 | |||
| 5 | Dan | 6 | 72 | |||
| 6 | Ella | 8 | 80 | |||
| 7 | Finn | 9 | 85 | |||
| 8 |
3 Example 3: Temperature and energy usage
A facilities team records daily temperature and energy consumption for a sample of seven days. The goal is to see whether warmer days are linked to higher or lower energy use. COVARIANCE.S(B2:B8,C2:C8) returns a negative number, meaning that as temperature rises, energy usage tends to fall in this sample. That pattern is common when heating demand drops on milder days.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Day | Temperature (C) | Energy (kWh) | |||
| 2 | 2024-01-08 | 2 | 120 | -60.33333333 | ||
| 3 | 2024-01-09 | 4 | 115 | |||
| 4 | 2024-01-10 | 6 | 108 | |||
| 5 | 2024-01-11 | 8 | 100 | |||
| 6 | 2024-01-12 | 10 | 95 | |||
| 7 | 2024-01-13 | 12 | 88 | |||
| 8 | 2024-01-14 | 14 | 82 | |||
| 9 |
4 Example 4: Advertising spend and sales by region
A sales manager has a sample of eight regions with advertising spend and sales. The goal is to check whether spend and sales move together before investing more. COVARIANCE.S(B2:B9,C2:C9) returns a large positive value, so higher-spend regions tend to have higher sales. Because covariance is in squared units, treat the sign and relative size as the signal rather than a standalone score.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Region | Ad Spend | Sales | |||
| 2 | North | 1200 | 18000 | 1650000 | ||
| 3 | South | 1500 | 21000 | |||
| 4 | East | 900 | 15000 | |||
| 5 | West | 2000 | 26000 | |||
| 6 | Central | 1100 | 17000 | |||
| 7 | Coastal | 1700 | 23000 | |||
| 8 | Mountain | 800 | 14000 | |||
| 9 | Valley | 1400 | 20000 | |||
| 10 |
5 Example 5: Wait time and satisfaction scores
A support team samples ten customer interactions, recording wait time in minutes and satisfaction on a 1–10 scale. The goal is to see whether longer waits are associated with lower satisfaction. COVARIANCE.S(B2:B11,C2:C11) returns a negative value, indicating that as wait time increases, satisfaction tends to decrease. The magnitude reflects minutes times points, so use the sign as the practical takeaway.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Ticket | Wait Time (min) | Satisfaction | |||
| 2 | T-01 | 3 | 9 | -13.77777778 | ||
| 3 | T-02 | 5 | 8 | |||
| 4 | T-03 | 7 | 8 | |||
| 5 | T-04 | 9 | 7 | |||
| 6 | T-05 | 11 | 6 | |||
| 7 | T-06 | 13 | 6 | |||
| 8 | T-07 | 15 | 5 | |||
| 9 | T-08 | 17 | 4 | |||
| 10 | T-09 | 19 | 3 | |||
| 11 | T-10 | 21 | 2 | |||
| 12 |
Common COVARIANCE.S errors and how to fix them
| Error | Why it happens | How to fix it |
|---|---|---|
| #N/A | The two ranges contain a different number of numeric values, so Excel cannot pair them. | Make both ranges the same size and shape, for example B2:B10 and C2:C10. |
| #DIV/0! | Fewer than two paired numeric values are available, so the n-1 denominator is zero. | Include at least two rows of numeric data in each range. |
| #VALUE! | One or both arguments are text, or a range contains text where numbers are expected in a way Excel cannot ignore. | Check that the cells contain numbers, not text that looks like numbers; remove stray labels from the ranges. |
| #NUM! | The calculation produces an invalid numeric result, often because the data are extreme or the ranges are effectively empty after ignoring text. | Verify the ranges contain valid numeric values and reduce extreme outliers if appropriate. |
Tips for using COVARIANCE.S
- Use COVARIANCE.S for samples and COVARIANCE.P for a complete population; the difference is the divisor n-1 versus n.
- Covariance depends on units, so compare signs and relative magnitudes rather than treating the number as a standardised score.
- Pair rows deliberately: both ranges should refer to the same rows so each observation is matched correctly.
- If you need a unit-free measure between -1 and 1, use CORREL or PEARSON instead.
- Keep the two ranges the same size; mismatched ranges are the most common cause of errors.
- Label your columns clearly so it is obvious which values are paired with which.
Frequently asked questions
What is the difference between COVARIANCE.S and COVARIANCE.P?
COVARIANCE.S divides by n-1 and is used when your data are a sample. COVARIANCE.P divides by n and is used when your data are the entire population. For small samples the difference can be noticeable.
Can COVARIANCE.S handle text or blank cells?
Text and blanks are ignored when the function pairs values, but the two ranges must still contain the same number of numeric values. If they do not, you may see #N/A.
Why is my covariance negative?
A negative result means the two variables tend to move in opposite directions: when one rises, the other tends to fall. That is a valid result, not an error.
Is covariance the same as correlation?
No. Covariance is not standardised and depends on the units of the data. Correlation is a scaled version between -1 and 1, which makes it easier to compare across different datasets.
Does COVARIANCE.S work with dates?
Dates are stored as numbers in Excel, so the function can process them, but the result is rarely meaningful. Use it with numeric measurements rather than date values.
Related functions
Every example on this page was recalculated by SheetSkill’s spreadsheet engine. COVARIANCE.S reference