Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Compute Variance in Excel: Step-by-Step

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

You can compute variance in Excel using the built-in VAR.S, VAR.P, or older VAR functions. The quickest way is to type =VAR.S(range) for a sample or =VAR.P(range) for an entire population. This article explains each function, when to use it, and how to avoid common errors.

What You'll Need

  • Microsoft Excel (2010 or later; functions work in Excel for Microsoft 365, Excel 2016, and newer versions).
  • A column or row of numeric data in a worksheet.
  • Basic familiarity with entering formulas (starting with an equals sign).

Step-by-Step

  1. Identify your data type. Decide whether your data is a sample (a subset of a larger group) or a population (the entire group). Use VAR.S for sample, VAR.P for population. Using the wrong one gives a different result.
  2. Click an empty cell where you want the variance to appear. Usually this is below or to the right of your data.
  3. Type the formula. For a sample, type =VAR.S(. For a population, type =VAR.P(. If you have an older version of Excel (before 2010), use =VAR( for sample or =VARP( for population.
  4. Select the data range. After typing the opening parenthesis, click and drag over the cells containing your numbers. For example, if your data is in cells A1 through A20, the formula becomes =VAR.S(A1:A20).
  5. Close the parenthesis and press Enter. Excel calculates the variance and displays the result in the selected cell.
  6. Format the result if needed. Variance is often a large number. Right-click the cell, choose Format Cells, then Number, and set decimal places as desired. For most statistical work, 2 to 4 decimal places is fine.

Example: Suppose you have test scores in cells B2:B11. To find the sample variance, click an empty cell, type =VAR.S(B2:B11), and press Enter. Excel returns the variance. If these scores represent all students in a class (population), use =VAR.P(B2:B11) instead.

Common Mistakes

  • Using VAR.S when you should use VAR.P. If your data is the entire group (e.g., all employees in a department), use VAR.P. Using VAR.S will give a slightly larger value because it divides by n-1 instead of n.
  • Including text or empty cells in the range. Excel ignores text and logical values in VAR.S and VAR.P, but if you accidentally include a cell with text, it may still work, but it’s safer to select only numeric cells. If you include empty cells, they are ignored, but if you include cells with formulas that return errors, the variance will show an error.
  • Selecting non-contiguous cells incorrectly. If your data is in separate columns, you can use multiple ranges separated by commas, like =VAR.S(A1:A10, C1:C10). But make sure you separate them with commas, not spaces.
  • Forgetting the equals sign. Typing VAR.S(A1:A10) without the equals sign will treat it as text, not a formula.
  • Using the wrong range. Double-check that your selected range covers all data points and no extra cells. A common error is including a header row or a total row.

Tips

  • Use named ranges for clarity. If you frequently compute variance on the same dataset, select the data, go to Formulas > Define Name, give it a name like "Scores", then use =VAR.S(Scores).
  • Understand the difference between variance and standard deviation. Variance is the average of squared deviations; standard deviation is the square root of variance. In Excel, use STDEV.S or STDEV.P for standard deviation. If you need both, compute variance first, then take the square root with =SQRT(cell).
  • Use the status bar for a quick check. Select your data, and look at the bottom-right status bar. If you right-click it and enable "Variance", it shows the sample variance instantly without typing a formula.
  • For large datasets, use a table. Convert your data to an Excel Table (Ctrl+T). Then the formula can use structured references like =VAR.S(Table1[Column1]), which automatically expands when you add rows.
  • Check for outliers. Variance is sensitive to extreme values. Before relying on it, sort your data or create a box plot to see if any numbers are unusually high or low.

Troubleshooting

If the result is #DIV/0! This means your range has fewer than 2 numeric values for VAR.S, or fewer than 1 for VAR.P. Check that you selected at least two numbers for a sample. If you have only one number, variance is undefined.

If the result is #VALUE! This often means your range contains text that Excel cannot interpret as a number, or a cell with an error like #N/A. Remove or fix the problematic cell. If you have text that looks like numbers (e.g., "10" with quotes), convert it to a number using the VALUE function or by re-entering it as a number.

If the result is #NAME? This means Excel doesn't recognize the function name. Check for typos. For example, VARS instead of VAR.S will cause this. Also, if you are using an older Excel version, VAR.S may not exist; use VAR instead.

If the result seems too large or too small. Variance is in squared units of your data. For example, if your data is in dollars, variance is in dollars squared. That is normal. To get a more interpretable number, compute the standard deviation instead. Also, verify that you used the correct function (sample vs population).

If the formula doesn't update when you change data. Excel recalculates automatically by default. If you have manual calculation mode on, press F9 to recalculate. To change it, go to Formulas > Calculation Options > Automatic.

Frequently Asked Questions

What is the difference between VAR.S and VAR.P?

VAR.S calculates variance for a sample of a population, dividing by n-1. VAR.P calculates variance for the entire population, dividing by n. Use VAR.S when your data is a subset; use VAR.P when you have all possible data points.

Can I compute variance for data with text or logical values?

No. VAR.S and VAR.P ignore text and logical values (TRUE/FALSE) in the range, but they do not use them in the calculation. If you want to count logical values, you need to convert them to numbers first (e.g., TRUE becomes 1).

How do I compute variance for multiple columns at once?

You can use multiple ranges in the formula, separated by commas: =VAR.S(A1:A10, C1:C10). This treats all numbers as one combined dataset. Alternatively, you can copy the data into a single column first.

What is the keyboard shortcut for variance?

There is no direct shortcut, but you can use the function wizard. Press Shift+F3 to open the Insert Function dialog, type "VAR" in the search box, select VAR.S or VAR.P, and then select your range.

Does Excel have a variance function for data with criteria?

Yes, you can use VARIF or VARIFS (not built-in, but you can create an array formula). However, the easiest way is to filter your data first, then apply VAR.S to the visible cells. Or use the DVAR function with a criteria range.

Why does my variance result differ from a calculator?

Check whether you used sample or population. Many calculators default to sample variance (n-1). Also, check if your calculator uses a different rounding. Excel stores numbers with high precision, so small differences can occur due to rounding in the calculator.