How to Calculate Variance In Excel

Sample and Population Variance

For a set of values representing an entire population, the Population Variance is give by the following equation:

Population Variance Equation

where x takes on each value in the set, x is the average (statistical mean) of the set of values, and n is the number of values in the set.

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

Sample Variance Equation

For examples of both population and sample variance calculations in Excel, see the Variance Examples below.

There are six different built-in functions for calculating variance in Excel. The Excel variance functions differ in the following ways:

Also, when Excel 2010 was released, two of the existing variance functions were updated and renamed. However, the old functions have not yet been removed from current versions of Excel, as Microsoft wishes to maintain compatibility with older versions of Excel.


Functions for Calculating Variance in Excel

The following table provides a description of the different types of variance function. This will help you to decide which of the functions you need to calculate a variance in Excel.



VAR.S vs. VARA and VAR.P vs. VARPA

The VAR.S and VARA functions, and the VAR.P and VARPA differ only in the way they handle text and logical values that are supplied as a part of an array or range of cells.

For example, if a range of cells containing the logical value TRUE is supplied to the VAR function, this will return a different result to the same range of cells supplied to the VARA function.

The treatment of text and logical values supplied to the variance functions is summarised in the following table:



Variance Examples

Example 1 - Calculate Population Variance in Current Versions of Excel

Example of use of the Excel Var.P Function

Cells B3-B14, D3-D14 and F3-F14 of the above spreadsheet on the right list a company's monthly sales figures, over three years.

If you have a current version of Excel (2010 or later), you can calculate the variance of the sales figures using the Excel VAR.P function. The formula for this is:

=VAR.P( B3:B14, D3:D14, F3:F14 )

which returns the result 6,170,524.69.



Example 2 - Calculate Sample Variance in Current Versions of Excel

Example of use of the Excel Var.S Function

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 of the spreadsheet.

If you have a current version of Excel (2010 or later), you can calculate the sample variance of the stored height measurements using the Excel VAR.S function. The formula for this is:

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

which returns the result 9.261904762 cm.