askvity

How do you calculate the variance in Excel?

Published in Excel Functions 3 mins read

Excel offers several built-in functions to calculate variance, depending on whether you're working with a sample or the entire population.

Calculating Population Variance

If you have data representing the entire population, use the VAR.P function.

  • Syntax: =VAR.P(number1, [number2], ...)
  • Explanation: number1, number2, etc., are the numbers or cell ranges that make up your population data.

Example: To calculate the population variance of the numbers in cells A1 through A10, you would use the formula =VAR.P(A1:A10).

Calculating Sample Variance

If you have data representing a sample of the population, use the VAR.S function.

  • Syntax: =VAR.S(number1, [number2], ...)
  • Explanation: number1, number2, etc., are the numbers or cell ranges that make up your sample data.

Example: To calculate the sample variance of the numbers in cells A1 through A10, you would use the formula =VAR.S(A1:A10).

Older Versions of Excel

Older versions of Excel (Excel 2007 and earlier) use VAR for sample variance and VARP for population variance. While these functions are still supported for compatibility, it's recommended to use VAR.S and VAR.P for clarity and consistency.

Step-by-Step Guide

  1. Enter your data: Input your data values into a column or row of cells in your Excel worksheet (e.g., A1:A10).
  2. Select a cell: Choose an empty cell where you want to display the calculated variance.
  3. Enter the formula: Type either =VAR.S(your_range) for sample variance or =VAR.P(your_range) for population variance, replacing your_range with the actual range of cells containing your data (e.g., A1:A10).
  4. Press Enter: Excel will calculate and display the variance in the selected cell.

Example:

Let's say you have the following sample data in cells A1:A5:

Cell Value
A1 10
A2 12
A3 15
A4 11
A5 13

To calculate the sample variance, you would enter the formula =VAR.S(A1:A5) into an empty cell. The result will be the sample variance of the data set.

Choosing the Right Function

The key difference between VAR.S and VAR.P is in the divisor used in the variance calculation. VAR.P divides by N (the total number of observations), while VAR.S divides by (N-1), providing an unbiased estimate of the population variance when working with a sample. Use VAR.S unless your data represents the entire population.

Related Articles