Variance Calculator
Variance is the average squared distance of the values from their mean. Square each value's difference from the mean, add the squares, then divide by N for a population or n − 1 for a sample. Enter your data separated by commas or spaces and choose which variance you need.
Last updated by Ultra Calculator
Variance
How to calculate it
Population: σ² = Σ(x − μ)² ÷ N Sample: s² = Σ(x − x̄)² ÷ (n − 1)
- σ²
- population variance
- s²
- sample variance
- x
- each value in the data set
- μ, x̄
- the mean of the data set (μ for a population, x̄ for a sample)
- N, n
- how many values there are
- Σ(x − x̄)²
- the sum of squared deviations (the sum of squares)
The standard deviation is the square root of the variance. In Excel, VAR.S gives the sample variance and VAR.P the population variance.
In Excel or Google Sheets: =VAR.S(A2:A11)
Worked example
Population variance of a whole class
If these ten scores are the whole class, the squared deviations from the mean of 86.9 add up to 220.9. Dividing by N = 10 gives a population variance of 22.09 and a standard deviation of 4.7.
| Data Set | 78, 82, 85, 88, 91, 94, 87, 83, 89, 92 |
|---|---|
| Sample or Population | Population variance (divide by N) |
| Number of Values | 10 |
|---|---|
| Mean | 86.9 |
| Variance | 22.09 |
| Standard Deviation | 4.7 |
| Sum of Squared Deviations | 220.9 |
| Divisor Used (N or n − 1) | 10 |
| Coefficient of Variation | 5.41% |
| Range | 16 |
| Sample or Population | Population |
How to use this calculator
- Enter your values in Data Set, separated by commas, spaces or semicolons, for example 4.2, 3.8, 4.5.
- In Sample or Population, choose population variance to describe the complete group, or sample variance to estimate a wider group's variance. The results appear once you choose.
- Read the Variance. Its units are the square of your data's units.
- Follow the working with the Mean, the Sum of Squared Deviations and the Divisor Used.
- Use the Standard Deviation when you need the spread back in the original units.
Frequently asked questions
How do you calculate variance?
Find the mean, subtract it from each value, square the differences and add them up. Divide that sum by N for a population or n − 1 for a sample. For 2, 4 and 6 the mean is 4, the squared deviations are 4, 0 and 4 (total 8), so the population variance is 8 ÷ 3 = 2.67 and the sample variance is 8 ÷ 2 = 4.
What is the difference between sample and population variance?
Population variance divides the sum of squares by N and describes a group you have measured in full. Sample variance divides by n − 1 and estimates the variance of a larger group from part of it. For the same list of two or more values, the sample figure is never smaller than the population figure.
Why is variance in squared units?
Each deviation is squared before the deviations are added, so lengths in cm give a variance in cm². Squaring stops positive and negative deviations cancelling out. Take the square root (the standard deviation) to get back to the original units.
Can variance be negative?
No. It is built from squared numbers, so the smallest possible variance is 0, which happens only when every value is the same. A negative result means a mistake in the working.
How do I calculate variance in Excel or Google Sheets?
Use =VAR.S(range) for a sample and =VAR.P(range) for a population, for example =VAR.S(A2:A11). Both functions skip empty cells and text in the range.
Learn more
The sum of squares
The sum of squared deviations, Σ(x − x̄)², is the raw measure of spread that variance, standard deviation and many tests are built on. Dividing it by N or n − 1 gives the matching variance.
Degrees of freedom
Once the sample mean is known, only n − 1 of the deviations can vary freely, because they must add up to zero. That is why sample variance divides by n − 1: there are n − 1 independent pieces of information about spread.
Why statisticians keep variance
For independent quantities, variances add: the variance of a sum is the sum of the variances. Standard deviations do not add this way, so variance is the form used inside regression, analysis of variance (ANOVA) and error propagation.
- Showing the sum of squares and divisor when checking homework or exam working
- Estimating process variability from a sample of measurements in quality control
- Getting the variance figure that a later formula, such as a pooled t-test, asks for
- Measuring how much survey ratings disagree around their average
- Comparing how evenly two machines or methods perform
Typing thousand separators
A comma always separates values, so 1,200 is read as two values, 1 and 200. Type 1200.
Using population variance for sample data
When you are estimating a wider group's variance from a sample, dividing by N tends to make it too small. Choose sample variance unless the list covers everyone.
Comparing variance directly with the mean
Variance is in squared units, so a variance of 25 next to a mean of 10 is not "two and a half times the mean". Use the standard deviation (here 5) to express spread in the original units.
Rounding the mean before squaring
Rounding the mean early introduces error into every squared deviation. Keep full precision until the final answer, as the calculator does.
- For the standard deviation alone, with the choice of sample or population, use the standard deviation calculator.
- The descriptive statistics calculator puts the population variance beside the median, quartiles and skewness.
- A variance of 0 means every value is identical. If that is unexpected, check the entries.
Methodology and sources
Values are split at commas, semicolons or spaces. The mean is the sum divided by the count. The calculator squares each value's difference from the mean, adds these up, and divides by N for population variance or n − 1 for sample variance. The Divisor Used row shows which: N or n − 1. The standard deviation is the square root of the variance, and the coefficient of variation is the standard deviation divided by the absolute value of the mean, times 100, left out when the mean is 0. Results show to 4 decimal places (CV to 2). Sample variance needs at least two values, and the calculator asks for more if you enter only one.