VAR.S(number1, [number2], ...) measures sample variance. It measures squared distance from the mean, so its units are the square of the input units. The divisor is n-1: use this when the observations are a sample of a larger population.
Try it
=VAR.S(-2,0,2) returns 4. The mean is zero and the squared deviations total eight. Divide by two.
Quirks
Numbers in references and arrays count, including zero; referenced text, logical values and empty cells do not. Direct logical values and numeric text can count, so moving a constant into a cell can change the admitted data set. An empty numeric set gives #DIV/0! and a one-value sample does too. A centered mathematical formula alone does not reproduce the observed numerical path.
The variance family uses raw moments with stored steps, and two tests switch it to a centered sum
With RN(v) meaning v rounded to 64 bits on the x87 unit and then stored to binary64, S the running RN sum of the n values and Q the running RN sum of RN(x*x), the sample variance is RN(RN(Q - RN(RN(S*S)/n))/(n-1)) and the population variance RN(RN(RN(n*Q) - RN(S*S))/RN(n*n)). Excel then uses a centered sum instead, adding RN(d*d) with d = RN(x - mean) and dividing by n-1 or n, when either of two stored tests holds: RN(RN(RN(S*S)/n)/Q) > 0.99, or RN(variance*1000) <= |RN(S/n)|. The STDEV functions are the root of this, rounded to 64 bits and then stored. So the answer depends on which path a call takes: the first two VAR.S calls below differ by a few input steps in two arguments, the first passes the 0.99 test and is correctly rounded, and the second takes the raw moments and lands 76 units high. The next pair shows the size test: scaling the inputs by 4 leaves the first path.
Explanation (inferred): These tests were located with scalar arguments in separate cells; that the same edges hold for ranges and arrays is inferred, and their readings have not been taken. RN(variance*1000) <= |mean| is not separated from the rearrangement variance <= |mean|/1000. That a raw moment which overflows also takes the centered sum is inferred from recorded answers that stay finite.
Formula
Excel
Mathematical value
VAR.S(0.8769085090206681, 1, 1.123091490979332) Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this readingInputs and reference value
Number supplied through a cell.
number1: 0.8769085090206681 0x3fec0fa26efa7e14
number2: 1 0x3ff0000000000000
number3: 1.123091490979332 0x3ff1f82ec882c0f6
0.01515151515151495 0x3f8f07c1f07c1e94
—
VAR.S(0.8769085090206679, 1, 1.1230914909793321) Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this readingInputs and reference value
Number supplied through a cell.
number1: 0.8769085090206679 0x3fec0fa26efa7e12
number2: 1 0x3ff0000000000000
number3: 1.1230914909793321 0x3ff1f82ec882c0f7
Exact rational variance of the binary64 inputs, correctly rounded.
0.015151515151515138 0x3f8f07c1f07c1f00
0.015151515151515006 0x3f8f07c1f07c1eb4
VAR.S(3.244042371786199e-10, 0.00034050419142641947) Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this readingInputs and reference value
VAR.S(1.2976169487144796e-09, 0.0013620167657056779) Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this readingInputs and reference value
Exact rational variance of the binary64 inputs, correctly rounded.
9.275430676564799e-07 0x3eaf1f88c6bbc519
9.2754306765648e-07 0x3eaf1f88c6bbc51a
=VAR.S({157,376.82,189.207,12.38,12.473,483,306.24,324.1852,482.235,78}) Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZAInputs and reference value
Typed formula.
Exact rational variance of the binary64 inputs, correctly rounded.
31907.480453381795 0x40df28debfbf8a84
31907.480453381777 0x40df28debfbf8a7f
STDEV.S(0, 1, 1.031052478719249) Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this readingInputs and reference value
Use the recorded staged algorithm when Excel compatibility is the goal. Here R(op) means: evaluate one operation with a 64-bit significand and extended exponent range, round to nearest with ties to even, then store to binary64 (53 significant bits). It is two rounding steps, not the language's ordinary double operation. The portable stored-arithmetic recipe implements both rounding steps with integer quotients and remainders, including binary64 subnormals and a staged square root. The product uses an x87 model. Disable contraction into a fused multiply-add.
Collect the admitted values in their traversal order. Set n to the count, S=0, Q=0. Reject an empty collection, and reject n<2 for a sample.
For each x, assign S=R(S+x) and Q=R(Q+R(x*x)). Then set T=R(S*S) and m=R(S/n).
For a sample, compute v=R(R(Q-R(T/n))/(n-1)). For a population, compute v=R(R(R(n*Q)-T)/R(n*n)). These expressions have different stored steps: do not algebraically combine them.
Test R(R(T/n)/Q)>0.99 and R(v*1000)<=abs(m). If either holds, recompute C from zero by d=R(x-m), C=R(C+R(d*d)), and return R(C/(n-1)) for a sample or R(C/n) for a population. The current code also takes this centered pass when raw moments are nonfinite.
For a standard deviation, take the square root at 64-bit significand precision and then store to binary64.
Worked raw path: for -2,0,2, n=3, S=0, Q=8, T=0, m=0. Neither guard holds. Sample variance is 8/2=4; population variance follows (3*8-0)/9=8/3. Sample standard deviation is 2.
Worked centered path: for 1000,1001,1002, S=3003, Q=3006005, T=9018009. The cancellation ratio is about 0.9999993, above 0.99. With m=1001, the centered squares are 1,0,1; their sum is 2, giving sample variance 1 or population variance 2/3.
The scalar guard edges and stored operations have discriminating recorded answers; range/array transfer at the newly located edges remains open. The overflow fallback is an inference from finite recorded answers, and the magnitude comparison has not been separated from its division-based rearrangement. This recipe describes a reconstruction over the cited evidence, not Microsoft's private source code.
Rust code
Show the CalcFunc source of this function
Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.
No implementation has been published with a Handbook test suite for this function.
Version differences
The recorded environments below distinguish a reading from a same-input comparison. Counts describe captured inputs in each environment; overlapping captures and comparisons are not totals of unique worksheet calls.
Excel 16.0 build
Platform and CPU
Captured inputs
20228
Windows, 64-bit, CPU not recorded
102
20430
Windows, 64-bit, CPU not recorded
1,211
The record contains no same-input comparison between these environments. Reading different inputs on different builds does not establish either a version change or cross-build agreement.
These are earlier recorded answers, not new Excel runs or an additional cross-build comparison. The function JSON retains each source locator, exact argument bits where available, and input-route status. Call notation does not imply that captured binary64 values were entered as decimal formula literals.
Excel 16.0 build 20527
Windows; bitness and CPU not recorded in this reading
VAR.S(0.8769085090206681, 1, 1.123091490979332) returned 0.01515151515151495 (0x3f8f07c1f07c1e94). VAR.S(0.8769085090206679, 1, 1.1230914909793321) returned 0.015151515151515138 (0x3f8f07c1f07c1f00). 2 further recorded controls are attached. Inputs were supplied through cells using Value2. These are controls from this environment, not a same-input comparison with another build.
Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
=VAR.S({157,376.82,189.207,12.38,12.473,483,306.24,324.1852,482.235,78}) returned 31907.480453381795 (0x40df28debfbf8a84). Inputs were supplied through formula literals. These are controls from this environment, not a same-input comparison with another build.
102 captured inputs are indexed for this environment. Capture dates: 2026-08-09 to 2026-08-09. This is a reading count, not a comparison with another build.
Excel 16.0 build 20430
Windows, 64-bit, CPU not recorded
1,211 captured inputs are indexed for this environment. Capture dates: 2026-09-29 to 2026-09-29. This is a reading count, not a comparison with another build. Retained control VAR.S(1,2) returned 0.5 (0x3fe0000000000000). The capture specifies exact-double bulk Value2 cell input.
Observed formulas and results
VAR.S(1,2) → 0.5 0x3fe0000000000000(cell-value2)
Alternatives
Use VAR.P when these observations are the whole population. STDEV.S reports sample spread in the original units. VARA includes logical values and referenced text under its broader collection rules.