Skip to content

VAR.S

Returns the variance of a sample: the average squared distance of values from their mean, using n - 1 in the divisor.

Syntax

=VAR.S(, [number2], ...)

Statistical

Excel 2010 and later, including Excel for Microsoft 365 and Excel for the web. The older VAR function works in every version.

Try it

Edit the formula in B8 or change the inputs. The sheet recalculates as you type.

B8
A
B
C
1
Day
Line A output
Line B output
2
Mon
50
40
3
Tue
51
60
4
Wed
49
50
5
Thu
50
30
6
Fri
50
70
7
8
Variance, Line A
0.5
9

B8 =VAR.S(B2:B6) returns 0.5

How VAR.S works

VAR.S measures how spread out a sample is. It averages the squared distance of each value from the mean, dividing by n − 1. Because the distances are squared, the result is in squared units, such as "days squared", which is hard to read directly. That is why most reports quote the standard deviation, STDEV.S, which is the square root of the variance. Variance is the figure you use when combining or comparing spread mathematically.

Why variance is still useful

Variances add up in ways standard deviations do not. When you add two independent measurements, their variances add, so the variance of total lead time is the sum of the variances of each stage. Statistical tests such as ANOVA and the F-test work with variances, and so does portfolio risk, where variance and covariance feed into the total.

Comparing the spread of two groups

If two production lines make the same product, the one with the larger variance is less consistent. A ratio of variances tells you how much more variable one is than the other. A line with variance 250 against another with variance 0.5 is far more erratic; the ratio of 500 says by how much, in squared units.

Sample versus population

VAR.S treats the numbers as a sample, so it divides by n − 1. Use it when your data is part of a bigger group and you want to estimate that group's variance. When your data is the whole group, use VAR.P instead, which divides by n. The gap matters most with small data sets: for five values the sample variance is 25% larger than the population variance.

What it ignores

In a range or cell reference, VAR.S ignores text, blanks and TRUE/FALSE. Numbers typed directly as arguments are counted. If the data contains an error value, the result is that error. With fewer than two numbers, VAR.S returns #DIV/0!.

VAR and VAR.S

The older VAR gives identical results. It stays in Excel for compatibility, but VAR.S is the name to use in new work. The matching functions for text-aware ranges are VARA and VARPA, which count text as zero and are rarely what you want.

The variance is always zero or positive. It is zero only when every value is identical. For summary measures of the centre, see AVERAGE and MEDIAN.

Arguments

number1
The first number, cell or range of the sample, such as B2:B6.
number2, ...optional
More numbers, cells or ranges, up to 254 more arguments. Text, blanks and TRUE/FALSE inside ranges are ignored.

Examples

Each example is a live sheet. Change the inputs or the formula and watch the result.

Example 1

Variance of a steady line

B8 =VAR.S(B2:B6)

Result: 0.5

The average is 50. Squared deviations of 0, 1, 1, 0 and 0 add up to 2, and 2 / (5 - 1) = 0.5.

B8
A
B
C
1
Day
Line A output
Line B output
2
Mon
50
40
3
Tue
51
60
4
Wed
49
50
5
Thu
50
30
6
Fri
50
70
7
8
Variance, Line A
0.5
9

B8 =VAR.S(B2:B6) returns 0.5

Example 2

Variance of an erratic line

C8 =VAR.S(C2:C6)

Result: 250

Both lines average 50, but Line B swings by 10 to 20 units either way. The squared deviations add up to 1,000, and 1,000 / 4 = 250.

C8
A
B
C
1
Day
Line A output
Line B output
2
Mon
50
40
3
Tue
51
60
4
Wed
49
50
5
Thu
50
30
6
Fri
50
70
7
8
Variance, Line B
250
9

C8 =VAR.S(C2:C6) returns 250

Example 3

Compare the two lines

B8 =VAR.S(C2:C6)/VAR.S(B2:B6)

Result: 500

Line B is 500 times as variable as Line A in squared units. The ratio of the standard deviations would be about 22.4.

B8
A
B
C
1
Day
Line A output
Line B output
2
Mon
50
40
3
Tue
51
60
4
Wed
49
50
5
Thu
50
30
6
Fri
50
70
7
8
Variance ratio B / A
500
9

B8 =VAR.S(C2:C6)/VAR.S(B2:B6) returns 500

Example 4

One value has no variance

B4 =VAR.S(B2)

Result: #DIV/0!

A sample needs at least two numbers, because the divisor is n - 1.

B4
A
B
C
1
Day
Output
2
Mon
50
3
4
Variance
#DIV/0!
5
6

B4 =VAR.S(B2) returns #DIV/0!

Your turn.

Solve it in the sheet. Every answer is checked, with hints if you need them.

Task 1 of 2

Five days are a sample of production. In B8, return the variance of Line A's output.

Answer in B8.

B8
A
B
C
D
E
1
Day
Line A output
Line B output
2
Mon
50
40
3
Tue
51
60
4
Wed
49
50
5
Thu
50
30
6
Fri
50
70
7
8
Line A variance
9
More variable line
10
11

Common mistakes

  • Variance is in squared units. A variance of 250 for output in units per day is 250 "units squared". Report the standard deviation when you want a figure in the original units.
  • VAR.S divides by n - 1. Use VAR.P only when your data is the whole group, or you will understate the variance.
  • With fewer than two numbers, VAR.S returns #DIV/0!.
  • Text, blanks and TRUE/FALSE in a range are ignored, so the result may use fewer values than you expect. Compare with COUNT.
  • Extreme values dominate variance because deviations are squared. One outlier can swamp everything else.

Questions people ask

What is the difference between VAR and VAR.S?

They return the same result. VAR.S is the newer name from Excel 2010, and VAR is kept for compatibility.

What is the difference between VAR.S and VAR.P?

VAR.S divides by n - 1 and treats the data as a sample. VAR.P divides by n and treats it as the whole population. VAR.S is always the larger of the two.

How is variance related to standard deviation?

Standard deviation is the square root of variance. `=SQRT(VAR.S(B2:B6))` equals `=STDEV.S(B2:B6)`.

Why does VAR.S return #DIV/0!?

The range holds fewer than two numbers. Check that the values are numbers and not text.

Learn VAR.S in a real sheet.

Tracks take you from the basics to modelling, one graded exercise at a time.