VAR.P & VAR.S: Variance Calculations Made Simple

VAR.S and VAR.P Functions for Variance Calculation in Excel Tutorial Blog Feature Image
Learn when to use VAR.S vs VAR.P in Excel. Covers population vs sample variance, portfolio risk, R² decomposition, conditional variance, and why variances add but standard deviations don’t.

Variance and standard deviation measure the same thing — spread — but variance keeps the result in squared units while standard deviation takes the square root to return to the original scale. Excel provides two variance functions that mirror the same sample-versus-population distinction found in STDEV.S and STDEV.P. VAR.S calculates sample variance, dividing by n−1. VAR.P calculates population variance, dividing by n. Choosing the wrong one produces a biased result — too small for a sample analysis, or unnecessarily inflated for a complete population.

Variance itself is not always the final output. It is frequently an intermediate step in larger calculations — portfolio risk, ANOVA, regression coefficients, and statistical tests all rely on it. This guide covers the syntax, the population versus sample decision, and six practical examples including portfolio variance, weighted variance, and the relationship between VAR and STDEV.

Availability: VAR.S and VAR.P are available in Excel 2010 and all later versions, including Microsoft 365, Excel 2024, 2021, 2019, and 2016. They also work in Google Sheets. The legacy VAR and VARP functions remain available but VAR.S and VAR.P are the recommended modern equivalents with clearer names.

What Is Variance?

Variance is the average of the squared differences between each data point and the mean. Squaring the differences serves two purposes. First, it removes negative signs so that values above and below the mean do not cancel each other out. Second, it amplifies large deviations more than small ones, making variance sensitive to outliers. Standard deviation is simply the square root of variance — it brings the result back to the original unit of measurement.

For example, if salary data has a variance of 25,000,000 (in squared pounds), the standard deviation is √25,000,000 = 5,000 (in pounds). Both measures describe the same spread. Variance is preferred in multi-step calculations because it avoids repeated square-root operations. Specifically, variances from independent components can be added together directly — standard deviations cannot.

What Is the Difference Between VAR.S and VAR.P?

The distinction is identical to the one between STDEV.S and STDEV.P. Use VAR.S when your data is a sample drawn from a larger population. Use VAR.P only when your data covers every member of the population with no exceptions. The n−1 denominator in VAR.S corrects for the tendency of sample data to underestimate the true population spread.

FeatureVAR.SVAR.P
Divides byn−1 (Bessel’s correction)n (total count)
Use whenData is a sample from a larger populationData IS the entire population
Legacy functionVAR (identical results)VARP (identical results)
Relationship to STDEVVAR.S = STDEV.S²VAR.P = STDEV.P²
MatchesR var(), Python std(ddof=1)², Pandas var()NumPy var() default (ddof=0)
Default choiceYes — correct for most real-world datasetsOnly when the dataset is truly complete
Quick decision rule: If any member of the group was not included in the data — because the data is a survey, a sample batch, a time window, or any subset — use VAR.S. If every single member is present and nothing was excluded, use VAR.P. When uncertain, VAR.S is the safer choice.

What Is the Syntax for VAR.S and VAR.P?

=VAR.S(number1, [number2], ...) =VAR.P(number1, [number2], ...)
ArgumentRequired?What it does
number1RequiredThe first number, cell reference, or range. Usually a column range like A2:A100. Text, logical values, and empty cells are ignored. Zeros are included.
number2, ...OptionalAdditional numbers or ranges, up to 255 arguments total. All values are pooled before variance is calculated.

Examples 1–4: Core Variance Calculations

1
Side-by-side comparison — VAR.S vs VAR.P on the same dataset

Running both functions on the same data makes the n versus n−1 difference immediately visible. The dataset below contains five delivery times. Notice that VAR.S is larger than VAR.P. Also notice that taking the square root of each variance returns the corresponding STDEV value — confirming that VAR and STDEV are always consistent with each other.

A2
A3
A4
A5
A6
VAR.S
VAR.P
12
15
11
18
14
7.30
5.84
Delivery times (days): {12, 15, 11, 18, 14}. Mean = 14. n = 5. VAR.S — sample variance, divides by n−1 = 4: =VAR.S(A2:A6) → 7.30 VAR.P — population variance, divides by n = 5: =VAR.P(A2:A6) → 5.84 Confirm: VAR.S = STDEV.S squared (always true): =VAR.S(A2:A6) = STDEV.S(A2:A6)^2 → TRUE Confirm: VAR.P = STDEV.P squared (always true): =VAR.P(A2:A6) = STDEV.P(A2:A6)^2 → TRUE Recover standard deviation from variance using SQRT: =SQRT(=VAR.S(A2:A6)) → 2.70 (same as STDEV.S)
2
Portfolio variance — combining asset variances and covariance

Portfolio risk in finance uses variance directly rather than standard deviation. This is because portfolio variance combines individual asset variances with a covariance term, and adding variances (not standard deviations) is mathematically valid. The COVARIANCE.S function works alongside VAR.S to build the full two-asset portfolio variance formula.

A2:A61 = monthly returns for Asset 1 (60 months of history). B2:B61 = monthly returns for Asset 2. w1 = weight of Asset 1 in portfolio (e.g. 0.60 = 60%). w2 = weight of Asset 2 (e.g. 0.40 = 40%). Individual variances — each asset treated as a sample: D2 = VAR.S(A2:A61) ← Asset 1 variance D3 = VAR.S(B2:B61) ← Asset 2 variance Sample covariance — how the two assets move together: D4 = COVARIANCE.S(A2:A61, B2:B61) ← positive = same direction Portfolio weights: D5 = w1 = 0.60 ← 60% in Asset 1 D6 = w2 = 0.40 ← 40% in Asset 2 Two-asset portfolio variance formula: σ²_portfolio = w1²σ²_1 + w2²σ²_2 + 2×w1×w2×Cov(1,2) $D$5^2 * $D$2 + $D$6^2 * $D$3 + 2 * $D$5 * $D$6 * $D$4 → Portfolio variance (monthly) Portfolio standard deviation — take square root to get annualised vol: Multiply by SQRT(12) to annualise monthly variance, then take root. =SQRT(($D$5^2*$D$2 + $D$6^2*$D$3 + 2*$D$5*$D$6*$D$4) * 12) → Annualised portfolio volatility
3
Signal-to-noise ratio — comparing variance between groups

Comparing variance between groups is a fundamental operation in experimental analysis. The F-ratio in ANOVA is the variance between groups divided by the variance within groups. A high F-ratio indicates that group means differ more than random chance would predict. VAR.S is used throughout because the groups are samples from larger populations.

Two groups: Control (A2:A31 = 30 observations) and Treatment (B2:B31). The F-ratio tests whether group means differ significantly. F = variance between groups / variance within groups. Group means: D2 = AVERAGE(A2:A31) ← control mean D3 = AVERAGE(B2:B31) ← treatment mean Group variances: D4 = VAR.S(A2:A31) ← variance within control group D5 = VAR.S(B2:B31) ← variance within treatment group Simple F-ratio — larger variance / smaller variance. A result above 1 means the numerator group has more spread. This is also the basis of the F-test for equal variances. =MAX(D4, D5) / MIN(D4, D5) → F-ratio for equal variance test Pooled variance — weighted average of both group variances: n1 = COUNT(A2:A31), n2 = COUNT(B2:B31). Pooled variance is used in two-sample t-tests assuming equal variance. ((COUNT(A2:A31)-1)*D4 + (COUNT(B2:B31)-1)*D5) / (COUNT(A2:A31) + COUNT(B2:B31) - 2) → Pooled sample variance across both groups
4
Production batch quality — VAR.P for a complete dataset

When every item in a production run is measured and recorded, the dataset is the full population. In this scenario VAR.P is correct because no sampling bias needs correcting. Quality engineers use population variance to define process limits and calculate capability indices. Additionally, the squared CV (coefficient of variation) uses variance to express spread as a proportion of the mean squared.

A2:A201 = measurements for all 200 items in a production batch. Every item was measured — this is the complete population. VAR.P is correct because nothing is being inferred from a sample. Population variance of the batch: =VAR.P(A2:A201) → True variance of this complete production run Process capability Cp using population variance: Cp = (USL − LSL) / (6 × STDEV.P). D2 = USL (upper spec limit), D3 = LSL (lower spec limit). ($D$2 - $D$3) / (6 * SQRT(=VAR.P(A2:A201))) → Cp index (above 1.33 = capable process) Squared coefficient of variation — variance as proportion of mean squared: CV² = VAR.P / AVERAGE². Compare spread across batches of different scales without unit bias. =VAR.P(A2:A201) / AVERAGE(A2:A201)^2 → Dimensionless relative dispersion measure

Examples 5 and 6: Applied Variance Analysis

Variance Decomposition and Conditional Analysis

5
Variance decomposition — total variance broken into components

Variance adds together in a way that standard deviation does not. This property makes it possible to decompose total variance into explainable and unexplainable components. In regression analysis the R² value is the ratio of explained variance to total variance. Calculating that ratio directly from VAR.S confirms the regression fit without needing the full regression output.

A2:A100 = actual values (observed). B2:B100 = predicted values (from a model or trendline). C2:C100 = residuals = A2 - B2 (actual minus predicted). Total variance of actual values: =VAR.S(A2:A100) → Total variance in the outcome variable Residual variance — the unexplained portion: C2:C100 = actual minus predicted values. =VAR.S(C2:C100) → Variance remaining after the model explains what it can R² — proportion of variance explained by the model: R² = 1 − (residual variance / total variance). A value of 0.85 means the model explains 85% of the variance. 1 - (=VAR.S(C2:C100) / =VAR.S(A2:A100)) → R² (confirm against RSQ function for the same data) Confirm: this R² matches Excel’s built-in RSQ function exactly. =RSQ(A2:A100, B2:B100) → Same result — useful cross-check when auditing a model
Variances from independent sources add together linearly. If a process has two independent sources of variation with variances of 4 and 9, the total process variance is 13 — and the total standard deviation is √13 ≈ 3.61, not 2+3=5. Always add variances, not standard deviations, when combining independent error sources.
6
Conditional variance — spread within a filtered subset

VAR.S and VAR.P do not support filtering natively. To calculate variance for a specific group — one region, one product, one department — combine them with IF in an array formula. In Excel 365, the formula enters normally. In Excel 2019 and earlier, press Ctrl+Shift+Enter to confirm it as an array formula.

A2:A200 = numeric values (e.g. sales amounts). B2:B200 = category labels (e.g. region names). Variance for a specific category — "North" region only. Excel 365 — enter normally, no array entry needed: =VAR.S(IF(B2:B200="North", A2:A200)) → Sample variance of sales for the North region only Excel 2019 and earlier — select cell, type formula, Ctrl+Shift+Enter: Curly braces { } appear in the formula bar to confirm array entry. {=VAR.S(IF(B2:B200="North", A2:A200))} Dynamic category — reference a cell instead of hardcoding the label: D2 = the category to analyse. Change D2 to switch the filtered group. =VAR.S(IF(B2:B200=$D$2, A2:A200)) Two-condition filter — region AND product: Multiply two IF conditions to require both to be true. Parentheses around each condition prevent operator precedence issues. =VAR.S(IF((B2:B200="North")*(C2:C200="Widget"), A2:A200)) → Variance of Widget sales in the North region only

Common Issues and How to Fix Them

VAR.S returns #DIV/0!

VAR.S requires at least two numeric values. With only one value, dividing by n−1 = 0 is undefined and returns #DIV/0!. This commonly happens when a conditional VAR.S(IF(...)) finds only one matching row, or when the range reference is incorrect and captures just one cell. VAR.P handles a single value without error — it returns zero — but statistically a variance of zero for one data point is meaningless. Add error handling with IFERROR to show a clear message: =IFERROR(VAR.S(A2:A100), "Insufficient data").

The variance result seems unexpectedly large

Variance is in squared units. A salary standard deviation of £5,000 produces a variance of 25,000,000 — which looks alarming until you remember the squaring. This is normal. If you need an interpretable measure of spread in the original unit, take the square root with SQRT or use STDEV.S directly. Variance is most useful as an intermediate value inside multi-step formulas, not as a reported statistic.

VAR gives a different result to what I expect from Python or R

Python’s NumPy np.var() divides by n (matching VAR.P) by default. Pandas df.var() divides by n−1 (matching VAR.S) by default. R’s var() also uses n−1, matching VAR.S. Consequently, if a NumPy result is smaller than Excel’s VAR.S, the two are using different denominators. Pass ddof=1 to NumPy to match VAR.S, or pass ddof=0 to match VAR.P.

Avoid the legacy VAR and VARP functions in new workbooks: VAR and VARP produce identical results to VAR.S and VAR.P respectively, but their names do not reveal whether the calculation is for a sample or a population. This creates ambiguity when sharing workbooks. Use VAR.S and VAR.P in all new files — the function name tells the reader exactly which denominator was used.

Frequently Asked Questions

  • What is the difference between VAR.S and VAR.P?+
    VAR.S calculates sample variance by dividing by n−1. VAR.P calculates population variance by dividing by n. Use VAR.S when your data is a sample drawn from a larger group — a survey, a batch test, a time window. Use VAR.P only when your data covers every member of the population with nothing excluded. VAR.S is correct for most real-world datasets. On large datasets the two results converge, but VAR.S is still technically correct for a sample regardless of size.
  • What is the relationship between variance and standard deviation?+
    Standard deviation is the square root of variance. VAR.S = STDEV.S² and VAR.P = STDEV.P². The two measures describe the same spread but in different units. Variance is in squared units — for example, squared pounds or squared days. Standard deviation returns to the original units, making it more directly interpretable. Use variance when you need to combine or decompose spread across components. Use standard deviation when you need to interpret or communicate the spread in the original unit of measurement.
  • Is VAR the same as VAR.S?+
    Yes — VAR and VAR.S produce identical results. VAR is the legacy function from Excel versions before 2010. Microsoft introduced VAR.S and VAR.P to make the sample versus population distinction explicit. VAR remains available for backward compatibility but VAR.S is recommended for all new workbooks. Similarly, VARP and VAR.P are identical — always use VAR.P going forward.

More Questions About Variance

  • Why do variances add but standard deviations do not?+
    When two sources of variation are statistically independent, their variances add together: Var(A+B) = Var(A) + Var(B). This additive property does not hold for standard deviations. For example, if process step A has a standard deviation of 2 and step B has a standard deviation of 3, the total is not 2+3=5. Instead, total variance = 4+9=13 and total standard deviation = √13 ≈ 3.61. This is why engineers and statisticians work with variance when combining independent error sources.
  • How do I calculate variance for a specific group or category?+
    VAR.S and VAR.P do not filter natively. Wrap them in IF to select specific rows: =VAR.S(IF(B2:B200="North", A2:A200)). In Excel 365, this enters as a normal formula. In Excel 2019 and earlier, press Ctrl+Shift+Enter to confirm as an array formula. For two conditions, multiply the IF tests: =VAR.S(IF((B2:B200="North")*(C2:C200="Widget"), A2:A200)). Reference a cell instead of hardcoding the category label to make the formula dynamic.
  • When should I use variance instead of standard deviation?+
    Use variance when your calculation involves combining or comparing multiple sources of variation, such as portfolio risk (where asset variances and covariances add), ANOVA, regression R², or pooled variance in t-tests. In these contexts, variance is mathematically necessary because of its additive property. Use standard deviation when you need to interpret or report spread in the original unit of measurement — for example, "the average delivery time varies by 2.7 days" is clearer than "the variance is 7.3 days²."