Calculates the sample variance of a set of numbers. Variance measures the average squared deviation from the mean. VAR uses the sample variance formula (n-1 denominator). Variance is the square of standard deviation. Essential for statistical analysis, measuring data variability, and understanding spread when working with sample data.
Master the fundamentals of Excel VAR function
The VAR function calculates the sample variance of a set of numbers. Variance measures the average squared deviation from the mean. VAR uses the sample variance formula with (n-1) denominator: Σ(xi - x̄)²/(n-1). Requires at least 2 values. Variance is the square of standard deviation: VAR = STDEV². VAR ≥ VARP always (for same data). Variance has squared units (not same scale as original data). Essential for statistical analysis, measuring data variability, understanding spread in samples, and calculating variance when working with sample data.
Uses n-1 denominator
Variance has squared units
Requires at least 2 numbers
Variance is squared STDEV
Function-specific parameters
Function-specific return type
Measure sample variability
Process variability in samples
Financial and business risk
Understanding sample spread
Exact matching required
Returns numeric position
Handles missing text gracefully
=VAR(number1, number2)First number, cell reference, or range representing a sample.
Additional numbers, cell references, or ranges (up to 255 arguments).
The sample variance
Description: Returns the sample variance of a set of numbers
Calculate sample variance
Returns 250. Variance measures average squared deviation from mean. VAR uses sample formula: Σ(xi - x̄)²/(n-1).
Use VAR function in VBA
' Basic VAR in VBA
Range("C1").Value = Application.WorksheetFunction.Var(Range("A1:A10"))
' Returns: Sample variance
' Calculate sample variance
Sub CalculateVAR()
Dim varValue As Double
varValue = Application.WorksheetFunction.Var(Range("A1:A10"))
Range("B1").Value = varValue
End Sub
' Compare VAR with VARP
Sub CompareVARVARP()
Dim varValue As Double
Dim varpValue As Double
varValue = Application.WorksheetFunction.Var(Range("A1:A10"))
varpValue = Application.WorksheetFunction.VarP(Range("A1:A10"))
Range("B1").Value = "VAR: " & varValue
Range("B2").Value = "VARP: " & varpValue
Range("B3").Value = "Difference: " & (varValue - varpValue)
End Sub
' Verify VAR = STDEV²
Sub VerifyVARFormula()
Dim varValue As Double
Dim stdevValue As Double
varValue = Application.WorksheetFunction.Var(Range("A1:A10"))
stdevValue = Application.WorksheetFunction.StDev(Range("A1:A10"))
Range("B1").Value = "VAR: " & varValue
Range("B2").Value = "STDEV²: " & (stdevValue * stdevValue)
' Should be equal (within rounding)
End Sub
' Statistical analysis with variance
Sub StatisticalAnalysis()
Dim meanValue As Double
Dim varValue As Double
Dim stdevValue As Double
meanValue = Application.WorksheetFunction.Average(Range("A1:A10"))
varValue = Application.WorksheetFunction.Var(Range("A1:A10"))
stdevValue = Application.WorksheetFunction.StDev(Range("A1:A10"))
Range("B1").Value = "Mean: " & meanValue
Range("B2").Value = "VAR: " & varValue
Range("B3").Value = "STDEV: " & stdevValue
Range("B4").Value = "STDEV²: " & (stdevValue * stdevValue)
End SubMeasure sample variability
Process variability in samples
Financial and business risk
Understanding sample spread
VAR returns #DIV/0! with less than 2 values
=IF(COUNT(A1:A10)>=2, VAR(A1:A10), "Need 2+ values")Solution: VAR requires at least 2 numeric values. With 0 or 1 value, it cannot calculate spread. Ensure you have at least 2 numeric values in the range.
Uncertainty about which to use
VAR for samples, VARP for populationsSolution: VAR uses sample formula (n-1) - use for samples. VARP uses population formula (n) - use for entire populations. VAR ≥ VARP. For most samples, use VAR.
Variance has squared units
VAR has squared units, STDEV has original unitsSolution: This is expected. Variance is in squared units. If data is in meters, variance is in meters². Use STDEV for original units (same scale as data).
Uncertainty about relationship
VAR(range) = STDEV(range)²Solution: Variance is the square of standard deviation: VAR = STDEV², so STDEV = √VAR. Both measure variability, but VAR is in squared units.