The Excel VAR Function

Related Function:
VARP Function
Variance & Sample Variance

The Variance is a statistical measure, that is commonly used across a set of values, to identify the amount that the values vary from the average value.

When your data set is a sample of a population, (rather than an entire population), you should use a slightly modified form of Variance, known as the Sample Variance. The equation for this is:

Sample Variance Equation


  • x takes on each value in the set;
  • x is the average of the set of values;
  • n is the number of values.
For further details, see the Wikipedia Variance page.

In Excel 2010, the VAR function has been replaced by the VAR.S function, which has improved accuracy.

Although it has been replaced, the Var function is still available in Excel 2010 (stored in the list of compatibility functions), to allow compatibility with earlier versions of Excel.

Function Description

The Excel VAR function returns the sample variance of a supplied set of values.

The syntax of the function is:

VAR( number1, [number2], ... )

Where the number arguments provide a minimum of 2 numeric values to the function. Each number argument can be a single value or an array of values.

You can enter up to 254 number arguments to the Var function in current versions of Excel (2007 and later), but you can only enter up to 30 number arguments in Excel 2003.

Note that the Var function calculates the sample variance (i.e. the variance for a sample of a population). If you are calculating the variance for an entire population, you should use the Excel Varp or the Excel Var.P function.

See the page on Variance in Excel for a comparison of the different Excel variance functions.

Var Function Example

Example of use of the Excel Var Function

Imagine you want to find out the variance of the heights of adult males in London. It is not realistic to measure the height of all males, but you could take a sample of the population and measure their heights.

The above example spreadsheet on the right stores the measurements (in cm) of 3,000 adult males. The measured heights are stored in cells B3-B1002, D3-D1002 and F3-F1002.

The variance of the heights of the sample group is calculated in cell H3 of the spreadsheet. The formula for this, (shown in the spreadsheet formula bar), is:

=VAR( B3:B1002, D3:D1002, F3:F1002 )

As shown in cell H3, the variance of the individual heights of the sample group is calculated as 9.261904762 cm.

Other Argument Types

The example above shows the arguments to the Var function being input in the form of 3 cell ranges. However, you can also input figures directly, as individual numbers or number arrays.

For example, if you wanted to include two further heights, of 176cm and 177cm into the sample you could add these directly into the above function as follows:

Either as individual numbers:

=VAR( B3:B1002, D3:D1002, F3:F1002, 176, 177 )

or, as an array of numbers:

=VAR( B3:B1002, D3:D1002, F3:F1002, {176,177} )

For further information and examples of the Excel Var function, see the Microsoft Office website.

Var Function Error

If you get an error from the Excel Var Function, this is likely to be one of the following:

Common Errors
#DIV/0! - Occurs if fewer than 2 numeric values have been supplied to the function.
#VALUE! - Occurs if any values that are supplied directly to the Var function are text values that cannot be interpreted as numbers.