How to Calculate Variance: Formula, Steps and Examples

shape
shape
shape
shape
shape
shape
shape
shape
How to Calculate Variance: Formula, Steps and Examples - featured image

Variance measures how far the numbers in a data set spread out from their average. A small variance means the values sit close to the mean, and a large variance means they are scattered. It is the foundation of standard deviation, and it appears in statistics classes, finance, quality control and science. This guide explains what variance is, gives the formulas for a population and a sample, walks through a full worked example by hand, shows the difference between variance and standard deviation, and explains how to calculate it in Excel with VAR.S and VAR.P, including the most common mistakes students make.

Updated November 2026

In this guide

  1. What variance means
  2. Population variance vs sample variance
  3. Steps to calculate variance by hand
  4. Worked example: sample variance
  5. Second worked example: test scores
  6. The shortcut formula
  7. Variance vs standard deviation
  8. Calculating variance in Excel
  9. What a high or low variance tells you
  10. Where variance is used in real work
  11. Practice problems
  12. Common mistakes

What variance means

Variance is the average of the squared distances between each value and the mean. Squaring does two jobs: it makes every difference positive, so values above and below the mean do not cancel out, and it gives more weight to values that are far from the mean. Because of the squaring, variance is expressed in squared units. If your data are heights in centimeters, the variance is in square centimeters, which is hard to picture. That is why people usually report the standard deviation, which is the square root of the variance and returns to the original units.

Average Calculator screenshot used in the guide: How to Calculate Variance
Check your answer with our free Average Calculator.

Population variance vs sample variance

There are two versions. Use population variance when your data include every member of the group you care about, such as all five employees in a small team. Use sample variance when your data are only a sample of a larger group, such as 30 customers chosen from thousands. The population formula divides by N, the number of values. The sample formula divides by n minus 1. Dividing by n minus 1 corrects for the fact that a sample tends to underestimate the spread of the full population. Most real data sets are samples, so the sample formula is the one you will use most often.

TypeSymbolFormulaDivide by
Populationσ²Sum of (x − μ)² ÷ NN
Samples²Sum of (x − x̄)² ÷ (n − 1)n − 1

Steps to calculate variance by hand

Follow these five steps. First, find the mean by adding all values and dividing by the count. Second, subtract the mean from each value to get the deviations. Third, square each deviation. Fourth, add up the squared deviations. Fifth, divide by N for a population or by n minus 1 for a sample. Write the steps in a small table so you can check each column, because a single arithmetic slip carries through to the final answer.

Worked example: sample variance

Take the data set 4, 8, 6, 5, 7. Step 1: the sum is 30 and the count is 5, so the mean is 6. Step 2: the deviations are 4−6 = −2, 8−6 = 2, 6−6 = 0, 5−6 = −1 and 7−6 = 1. Step 3: the squared deviations are 4, 4, 0, 1 and 1. Step 4: the sum of squares is 10. Step 5: for a sample, divide by 5−1 = 4, so the sample variance is 2.5. For a population, divide by 5, so the population variance is 2. The standard deviation is the square root: about 1.58 for the sample and about 1.41 for the population. Notice that the deviations add up to zero, which is a good check on the mean.

ValueDeviationSquared
4-24
824
600
5-11
711
Total010

Second worked example: test scores

A teacher records the scores 70, 80, 90 and 100 for a small class and wants the sample variance. The mean is 340 divided by 4, which is 85. The deviations are −15, −5, 5 and 15. The squares are 225, 25, 25 and 225, which add up to 500. Divide by 4−1 = 3 to get a sample variance of about 166.67. The standard deviation is about 12.91 points. If the same four students were the whole class and the teacher only cared about them, the population variance would be 500 divided by 4, which is 125. This example shows how much the choice between the formulas matters with small groups. With large groups the two results become very close.

The shortcut formula

There is an equivalent formula that avoids calculating each deviation: variance equals the mean of the squares minus the square of the mean. For the data 4, 8, 6, 5, 7, the squares are 16, 64, 36, 25 and 49, which add up to 190. The mean of the squares is 38. The square of the mean is 36. The population variance is 38 minus 36, which is 2, the same as before. This version is quicker with a basic calculator, but it can lose accuracy when the numbers are large and close together, so the deviation method is safer.

Variance vs standard deviation

Variance and standard deviation describe the same idea in different units. Variance is easier to use in mathematical formulas, because variances of independent variables add together. Standard deviation is easier to interpret, because it is in the same units as the data. For a normal distribution, about 68 percent of values fall within one standard deviation of the mean. When you report results to a general audience, use the standard deviation. When you build a model or compare the spread of groups with formulas, the variance is often more convenient. Use our standard deviation calculator to check your work, and see our guide to calculating standard deviation for more examples.

Calculating variance in Excel

Excel has built-in functions for both types. =VAR.S(A2:A6) returns the sample variance, and =VAR.P(A2:A6) returns the population variance. For the data 4, 8, 6, 5, 7, VAR.S returns 2.5 and VAR.P returns 2. The older functions VAR and VARP still work for compatibility, but Microsoft recommends the newer names. The matching functions for standard deviation are STDEV.S and STDEV.P. If your range contains text or blanks, Excel ignores them, but a zero is counted as a value, so make sure empty cells are truly empty. See the Microsoft guide to the STDEV.S function for related details.

What a high or low variance tells you

A variance of zero means every value is identical. A low variance means the data are consistent, which is good for a manufacturing process that should produce parts of the same size. A high variance means the data are spread out, which in finance means higher risk, because returns can differ widely from the average. Variance cannot be negative, so a negative result means there is an error in your calculation. Comparing variances only makes sense for data measured in the same units, and for data with very different averages it is better to compare the coefficient of variation, which is the standard deviation divided by the mean.

Where variance is used in real work

Variance shows up in many everyday jobs. In quality control, a factory tracks the variance of part sizes, and a rising variance warns that a machine is wearing out before parts fail inspection. In finance, analysts compare the variance of two investments: both may average a 7 percent return, but the one with the larger variance swings more from year to year and is therefore riskier. In education, teachers compare the variance of scores between classes to see whether one class has a wide mix of abilities. In sports analytics, a player with a low variance in points per game is more predictable than one with a high variance. In business reporting, budget variance is a different idea, the difference between planned and actual figures, so check the context before you use the word. When you present results to a client, state whether you used the sample or the population formula, give the sample size, and add the standard deviation so the reader can see the spread in familiar units.

Practice problems

Try these. Problem 1: find the population variance of 2, 4, 6 and 8. The mean is 5, the squared deviations are 9, 1, 1 and 9, which add to 20, so the variance is 5. Problem 2: find the sample variance of the same data. Divide 20 by 3 to get about 6.67. Problem 3: find the sample variance of 10, 10, 10 and 10. Every deviation is zero, so the variance is 0. Problem 4: a data set has a sample variance of 16. What is its standard deviation? The square root of 16 is 4. Problem 5: if you add 5 to every value in a data set, what happens to the variance? Nothing, because shifting all values leaves the spread unchanged. If you multiply every value by 3, the variance is multiplied by 9.

Common mistakes

The most common mistake is using N instead of n minus 1 for a sample, or the reverse. Another is to forget to square the deviations, which makes the sum equal zero. A third is to square the sum of the deviations instead of summing the squared deviations. A fourth is to report variance when the question asks for standard deviation, or to forget the units are squared. Finally, rounding the mean too early causes small errors, so keep extra decimals until the last step and round only the final answer.

Frequently asked questions

What is the formula for variance?

Variance is the sum of squared deviations from the mean divided by N for a population or by n minus 1 for a sample.

What is the difference between variance and standard deviation?

Standard deviation is the square root of variance and is in the same units as the data.

Can variance be negative?

No. Because the deviations are squared, variance is zero or positive.

How do I calculate variance in Excel?

Use VAR.S for a sample and VAR.P for a population.

Why divide by n minus 1 for a sample?

It corrects the tendency of a sample to underestimate the spread of the whole population.

Related guides and free tools

Sources: STDEV.S function, Microsoft Support

Leave a Reply

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