Written and maintained by CASRAI Editorial Board
Last updated
To find population variance, subtract the population mean from every value, square each difference, add the squares, and divide the total by N, the number of values in the whole population. The result, written σ², is the average squared distance from the mean. Because the data cover every member of the population, there is no estimating and no n − 1 correction. The steps below work one example through by hand, then show what Excel, R and Python each return, because the three tools do not default to the same divisor.
How to find population variance: definition and formula
Population variance measures how far the values in a complete population spread around their mean. It is the second moment about the mean: the average of the squared deviations. A variance of zero means every value is identical; larger values mean wider spread.
σ² = Σ(xi − μ)² / N, summed from i = 1 to N.
- σ² (sigma squared): the population variance.
- xi: the i-th value in the population.
- μ (mu): the population mean, the sum of all values divided by N.
- N: the number of values in the population.
- Σ: add up the terms for every value.
The numerator is the sum of squared deviations, covered on its own in the sum of squares formula guide. The square root of σ² is the population standard deviation, σ. If your data are only a sample drawn from a larger population, use the divisor n − 1 instead; that case is in how to find sample variance.
How to calculate population variance step by step: worked example
Suppose a lab has exactly five incubators and the data are the number of alarm events each logged last month: 6, 8, 9, 5, 12. These five numbers cover every incubator of interest, so this is a population, not a sample.
- Mean. 6 + 8 + 9 + 5 + 12 = 40, and 40 / 5 = 8, so μ = 8.
- Deviations from the mean. 6 − 8 = −2; 8 − 8 = 0; 9 − 8 = 1; 5 − 8 = −3; 12 − 8 = 4.
- Square each deviation. 4, 0, 1, 9, 16.
- Add the squares. 4 + 0 + 1 + 9 + 16 = 30.
- Divide by N. N = 5, so σ² = 30 / 5 = 6.
- Optional: standard deviation. σ = √6 = 2.449 (three decimals).
This is the answer to “how to get population variance” for any data set: only the numbers change, never the order of the steps. A check that catches most slips: the deviations from the mean always add to zero (−2 + 0 + 1 − 3 + 4 = 0). Had the same five numbers been a sample, the divisor would be 4 and the answer 7.5, a 25 percent difference from one choice of denominator.
Interpretation: what the result means
The Python documentation describes variance as a measure of variability: a large variance indicates that the data are spread out, and a small variance indicates they are clustered closely around the mean. Read the number with the points below.
| Result | What it tells you |
|---|---|
| σ² = 0 | Every value equals the mean; there is no spread. |
| Small σ² relative to the data’s scale | Values cluster closely around μ. |
| Large σ² relative to the data’s scale | Values are spread out around μ. |
| Units | Squared units of the data (events² in the example), so take the square root, σ, to get back to the original units: 2.449 events. |
Variance is on a squared scale, so it only has meaning relative to the data it came from; compare variances only for variables measured in the same units. The NIST/SEMATECH e-Handbook of Statistical Methods notes that squaring gives far-away values extra weight, so variance can be greatly affected by the tail behavior of the data.
Assumptions and common mistakes
- The data really are the whole population. Population variance applies when you have every member: all five incubators, every unit in a closed production lot, a full census. If you measured a subset and want to say something about the larger group, you need the sample formula.
- Using n − 1 on a full population. That inflates the answer. The 10/9 gap between 754.27 and 678.84 in the Excel example below is exactly this choice.
- Using the population function on a sample. The Python documentation says that applied to a sample, pvariance gives the biased sample variance, also known as variance with N degrees of freedom.
- Reporting variance as if it were in the original units. It is in squared units; report σ when you want the spread in the units of measurement.
- Letting a few extreme values dominate. Because deviations are squared, one outlier can account for most of the sum. In the example, the value 12 contributes 16 of the total 30.
How to report population variance (APA example)
The APA Style numbers and statistics guide (7th edition, last updated September 11, 2024) says to use italics for letters used as statistical symbols, but standard nonitalic type for Greek letters. So the population variance symbol σ² stays upright. The same guide advises reporting means, standard deviations and other statistics to two decimals in general (one decimal for data on integer scales), with a space on both sides of an operator.
Example: Across the five incubators (N = 5), the number of alarm events had a mean of μ = 8.00 and a population variance of σ² = 6.00 (σ = 2.45).
Say in the text that the figure is a population value, since a reader seeing only “variance = 6.00” cannot tell which divisor produced it.
How to compute the population variance in Excel, R or Python
All three snippets return 6 for the worked example.
Excel: VAR.P
Microsoft documents VAR.P as the function that calculates variance based on the entire population, ignoring logical values and text in the population. Syntax: VAR.P(number1, [number2], …); number1 is required, with up to 254 arguments.
=VAR.P(A1:A5)
=VAR.S(A1:A5)
With 6, 8, 9, 5, 12 in A1:A5, VAR.P returns 6 and VAR.S, the sample version with divisor n − 1, returns 7.5.
Microsoft’s own example range (1345, 1301, 1368, 1322, 1310, 1370, 1318, 1350, 1303, 1299, breaking strengths) returns VAR.P = 678.84 and VAR.S = 754.27. The ratio is 10/9, which is N / (N − 1) for ten values.
R: no built-in population variance
The R documentation says var() uses the denominator n − 1, so it returns the sample variance. For the population version, compute it directly; this is a short calculation, not a built-in function.
x <- c(6, 8, 9, 5, 12)
mean((x - mean(x))^2) # 6, population variance
var(x) * (length(x) - 1) / length(x) # 6, same result from var()
sqrt(mean((x - mean(x))^2)) # 2.449, population standard deviation
More on R’s spread functions is in standard deviation in R.
Python: statistics.pvariance
The Python standard library documents pvariance as returning the population variance of a non-empty sequence or iterable of real-valued numbers, and says to use it to calculate the variance from the entire population; for a sample, variance() is usually the better choice. It raises a StatisticsError if the data are empty.
import statistics
data = [6, 8, 9, 5, 12]
statistics.pvariance(data) # 6
statistics.pstdev(data) # 2.449489742783178
statistics.variance(data) # 7.5, the sample version
Frequently asked questions
How to find population variance?
Find the mean of all N values, subtract it from each value, square the differences, add them, and divide by N. In the example, 30 / 5 = 6.
How to get population variance from a calculator or spreadsheet?
Use the function whose name signals the whole population: VAR.P in Excel, or statistics.pvariance in Python. R has no such function; use mean((x – mean(x))^2).
How to compute the population variance and the standard deviation together?
Compute σ² first, then take its square root for σ. Python’s pstdev does both steps in one call. The pooled version for several groups is in pooled standard deviation.
How to calculate population variance when I only have a sample?
You calculate the sample variance, dividing by n − 1, because a sample mean is estimated from the same data. See how to find sample variance, and descriptive vs. inferential statistics for when each applies.
How to find a population variance for a different data set?
The steps do not change; only the numbers do. For how two variables vary together, the related quantity is covariance; see the covariance formula guide.
Sources
- Python Software Foundation. statistics — Mathematical statistics functions (pvariance, pstdev, variance). https://docs.python.org/3/library/statistics.html. Date checked: 2026-10-29.
- Microsoft Support. VAR.P function. https://support.microsoft.com/en-us/office/var-p-function-73d1285c-108c-4843-ba5d-a51f90656f3a. Date checked: 2026-10-29.
- NIST/SEMATECH. e-Handbook of Statistical Methods, Measures of Scale. https://www.itl.nist.gov/div898/handbook/eda/section3/eda356.htm. Date checked: 2026-10-29.
- American Psychological Association. (2024). APA Style numbers and statistics guide. https://apastyle.apa.org/instructional-aids/numbers-statistics-guide.pdf. Date checked: 2026-10-29.
- R Core Team. Correlation, Variance and Covariance (Matrices), stats package manual. https://stat.ethz.ch/R-manual/R-devel/library/stats/html/cor.html. Date checked: 2026-10-29.








