# The Excel VAR.P Function

Related Function:
VAR.S Function
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.

For any set of values, x, the equation for calculating the Variance is:

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

Further details are provided on the Wikipedia Variance page

## Basic Description

The Excel VAR.P function returns the Variance of a given set of values.

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

The syntax of the Var.P function is:

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

Where the number arguments are values or arrays of values that provide a minimum of 2 numeric values to the function. The maximum number of arguments that can be supplied to the VAR.P function is 254.

### Alternative Excel Variance Functions

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

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

## Var.P Function Example

A company keeps a record of its monthly sales figures, over the last three years. These are stored in cells B3 - B14, D3 - D14 and F3 - F14 of the above example spreadsheet on the right.

The variance of the three years' sales figures is calculated in cell H3 of the spreadsheet. The formula for this, as shown in the formula bar, is:

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

As shown in cell H3, the variance for the 3 years of sales figures is 6,170,524.69.

### Other Argument Types

The example above shows the arguments to the Var.P 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, during January and February 2010 the sales figures are 13,000 and 14,500 we can add these directly into the above function as follows:

Either as individual numbers:

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

Or, as an array of numbers:

=VAR.P( B3:B14, D3:D14, F3:F14, {13000,14500} )

This gives the updated variance of 5,930,921.05.

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

## Var.P Function Error

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

Common Error
 #DIV/0! - Occurs if none of the values that have been supplied to the function are numeric. #VALUE! - Occurs if any values that are supplied directly to the Var.P function are text values that cannot be interpreted as numeric values.

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

Common Problem: Values Stored as Text

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

The Var.P 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 numeric 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 Data tab at the top of your Excel workbook, select the Text to Columns ... option;
• Ensure the Delimited option is selected and click next;
• Ensure all the Delimiters are unchecked and click next again;
• You should now be offered a selection of Column Data Formats. Select General and click the Finish button.