ExcelFunctions.net

Search site:

Related Function:

VAR.P 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 :

where x is the average (statistical mean) of the set of values, and n is the number of values.

A full explanation can be found on the Wikipedia Variance pageThe Excel VAR.S function calculates the sample variance of a supplied set of values.

The VAR.S function is new to Excel 2010. However, this is simply an improved (slightly more accurate) version of the VAR function, which is available in earlier versions of Excel.

The format of the function is :

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

Where the number arguments are up to 254 values or arrays of values. You must provide a minimum of 2 values to the function.

Note that the Var.S function is used when calculating the variance for a __sample__ of a population
(eg. if your data set records the individual heights of a sample of UK males).
If you are calculating the variance for an __entire__ population, you need to use the Excel
Var.P function.

Note also, that the Var.S function ignores text values and logical values if these are supplied
as part of an array. However, if they are supplied directly to the function, text representations of
numbers and logical values __are__ interpreted as numbers. If you want a sample variance functon
that does not ignore text and logical values that are supplied as a part of an array, consider using
the Vara function.

Imagine you wanted 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 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, as shown in the formula bar, is :

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

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

The example above shows the arguments to the Var.S 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 we could add these directly into the above function as follows:

Either as individual numbers:

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

Or, as an array of numbers:

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

Further information and examples of the Excel Var.S function can be found on the Microsoft Office website.

If you get an error from the Excel Var.S Function, this is likely to be the #DIV/0! error:

Common Error

#DIV/0! | - | Occurs if fewer than 2 numerical values have been supplied to the function |

Some users may also encounter the following problem with the Var.S function:

Common Problem: Values Stored as Text

If you are getting an unexpected result from the Var.S function, this may be because you are supplying the function with text representations of numbers, rather than numerical values.

The Var.S function will interpret logical values or text representations of numbers __if they are
supplied directly to the function__. However, if the function is supplied with an __array of cells
containing__ logical values or text representations of numbers, these cells are ignored in the
calculation.

The different Excel data types are explained in more detail on the Excel Formatting page.

Solution

You can fix this problem by converting all text representations of numbers into numerical values. One way to do this is using the Text-To-Columns command:

- Use the mouse to select the cells you want to convert to values (this must not span more than one column)
- From the
**D**tab at the top of your Excel workbook, select the__a__ta**T**option__e__xt to Columns ... - Ensure the
option is selected and click__D__elimited**next** - Ensure all the Delimiters are unchecked and click
**next**again - You should now be offered a selection of Column Data Formats. Select
and click the__G__eneralbutton__F__inish