ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Math
  3. How to Calculate Variance in Excel With VAR.S and VAR.P

How to Calculate Variance in Excel With VAR.S and VAR.P

By ExcelReady Team·Updated November 3, 2026·6 min read

The short answer

To calculate variance in Excel, use =VAR.S(range) when your numbers are a sample of a bigger group, or =VAR.P(range) when they are the whole group. Variance is the average squared distance from the mean, so its units are squared. Take its square root and you get the standard deviation. When unsure, use VAR.S.

Key takeaways

  • VAR.S is for a sample and divides by n − 1. VAR.P is for a whole population and divides by n.
  • Variance is in squared units, so it is hard to read on its own; its square root is the standard deviation.
  • By hand: subtract the average, square each difference, add them up, then divide by n − 1 or n.
  • VAR and VARP are older names for VAR.S and VAR.P, and give the same results.
  • In budgeting, variance means actual minus budget, which is a different calculation.
On this page+
  1. What is variance?
  2. How to calculate variance with VAR.S and VAR.P
  3. VAR.S or VAR.P: which should you use?
  4. How to calculate variance by hand
  5. Variance and standard deviation
  6. Other variance functions and versions
  7. Common variance mistakes
  8. Practise it

To calculate variance in Excel, type =VAR.S(range) if your numbers are a sample, or =VAR.P(range) if they are the whole group you care about. Variance measures how spread out values are around their average. This guide shows which function to choose, how to work the number out by hand so you understand it, and how variance relates to standard deviation.

What is variance?#

Variance is the average of the squared distances between each value and the mean (the average). A small variance means the values sit close together. A large one means they are spread out.

Squaring does two jobs: it stops values below the mean from cancelling out values above it, and it gives big gaps more weight than small ones. The cost is that the result is in squared units. If you measure tickets, variance is in "tickets squared", which is hard to picture. That's why people often report the standard deviation, the square root of variance, which is back in the original units.

All the examples use six days of support tickets in B2:B7:

AB
1DayTickets
2Mon12
3Tue15
4Wed9
5Thu14
6Fri10
7Sat18

The average is 13 tickets a day. The AVERAGE function guide covers that first step.

How to calculate variance with VAR.S and VAR.P#

Select an empty cell and type the function with your range:

Excel formula
=VAR.S(B2:B7)
=VAR.P(B2:B7)
FunctionUse it forDivides byResult
VAR.SA sample taken from a bigger groupn − 1 = 511.2
VAR.PThe whole populationn = 69.33

Both functions ignore empty cells, text and TRUE/FALSE values inside a range. VAR.S needs at least two numbers, or it returns #DIV/0!.

VAR.S or VAR.P: which should you use?#

Use VAR.S unless your data truly contains every member of the group you're describing. These six days are probably a sample of a longer period, so VAR.S is the right choice for them.

  • VAR.S (sample): six days out of a year, 50 survey replies out of 10,000 customers, a batch of products tested from a production run.
  • VAR.P (population): every employee on one team, all 12 months of a finished year when you only care about that year, every exam score in a class when you're describing only that class.

Why divide by n − 1 for a sample? A sample tends to miss the most extreme values in the full group, so its spread comes out a little too small. Dividing by one less than the count makes the result slightly bigger and corrects for that. The gap matters for small samples and almost disappears for large ones. The same choice applies to standard deviation; see STDEV.S vs STDEV.P for a side-by-side comparison.

How to calculate variance by hand#

Working through the steps once shows exactly what VAR.S does. Add helper columns next to the data:

  1. Find the mean: =AVERAGE(B2:B7) gives 13.
  2. Subtract the mean from each value: in C2, =B2-AVERAGE($B$2:$B$7), filled down.
  3. Square each difference: in D2, =C2^2, filled down.
  4. Add the squares: =SUM(D2:D7) gives 56.
  5. Divide: by n − 1 for a sample (56 ÷ 5 = 11.2) or by n for a population (56 ÷ 6 = 9.33).
TicketsDifference from 13Squared
12−11
1524
9−416
1411
10−39
18525
Total56

You can do all five steps in one cell with SUMPRODUCT, which multiplies and adds arrays without helper columns:

Excel formula
=SUMPRODUCT((B2:B7-AVERAGE(B2:B7))^2)/(COUNT(B2:B7)-1)

The result is 11.2, the same as VAR.S. Replace COUNT(B2:B7)-1 with COUNT(B2:B7) to match VAR.P. Excel also has DEVSQ, which returns the sum of squared differences directly: =DEVSQ(B2:B7) gives 56.

Variance and standard deviation#

Standard deviation is simply the square root of variance, so you can always get one from the other:

Excel formula
=SQRT(VAR.S(B2:B7))

The result is about 3.35 tickets, the same as =STDEV.S(B2:B7). Going the other way, =STDEV.S(B2:B7)^2 gives 11.2. Report standard deviation when you want people to understand the spread ("about 3 tickets either side of 13"). Use variance when a formula needs it, for example when you combine the spread of independent parts, because variances add up and standard deviations don't. For more, read how to calculate standard deviation in Excel.

To see how one extreme value affects the centre of the data, compare the mean with the median; the guide to MEDIAN and MODE shows how.

Other variance functions and versions#

Excel has a few related functions you may see in older files:

FunctionWhat it does
VAR, VARPOlder names for VAR.S and VAR.P. Same results
VARA, VARPALike VAR.S and VAR.P, but count text as 0 and TRUE as 1
DVAR, DVARPVariance of rows that match a criteria range

VAR.S and VAR.P work in Excel 2010 and later, including Microsoft 365 and Excel for Mac. For the variance of one group only, such as North sales, Microsoft 365 users can write =VAR.S(FILTER(C2:C50,B2:B50="North")).

Common variance mistakes#

These slips cause most wrong answers:

  1. Using VAR.P for a sample. It gives a smaller number that understates the real spread. When in doubt, use VAR.S.
  2. Numbers stored as text. VAR.S skips them in a range, so the result is based on fewer values than you think. Check with COUNT.
  3. Mixing up the two meanings of variance. In budgeting, "variance" means actual minus budget, such as 5,200 − 5,000 = 200 over budget. That's a simple subtraction, not VAR.S. See budget vs actual variance.
  4. Reading variance as if it were in normal units. A variance of 11.2 tickets squared doesn't mean "about 11 tickets either side". Take the square root first.
  5. Averaging values that have different weights. If each value stands for a different number of items, start with a weighted average instead of a plain one.

Practise it#

Try the exercise on this page: you rebuild VAR.S from AVERAGE, SUMPRODUCT and COUNT, so the formula stops being a black box. Then practise AVERAGE, MIN and MAX in a live spreadsheet and move on to the MEDIAN and MODE lesson, where each answer is checked instantly. For a wider summary toolkit, see AVERAGE, MIN and MAX explained.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Work out the sample variance of the tickets by hand. Click D2 and type =SUMPRODUCT((B2:B7-AVERAGE(B2:B7))^2)/(COUNT(B2:B7)-1), then press Enter. It should match what VAR.S returns.

fx
ABCDE
1
Day
Tickets
2
Mon
12
Sample variance
3
Tue
15
4
Wed
9
5
Thu
14
6
Fri
10
7
Sat
18
8
9
10

Tip: Subtract the average from every value, square the differences, add them up with SUMPRODUCT, then divide by the count minus 1.

Practise this in a lesson

LessonAVERAGE, MIN and MAXSummarize a list with its average, smallest and largest values.LessonMEDIAN and MODESee how one outlier skews an average, and describe typical values with MEDIAN and MODE.Function guideAVERAGECalculate the mean in Excel with AVERAGE. See how it treats blanks and zeros, avoid common errors, and practice in a live sheet.

Frequently asked questions

What is the formula for variance in Excel?

+

Use =VAR.S(A2:A20) for a sample or =VAR.P(A2:A20) for a whole population. Both return the average squared distance of each value from the mean.

Should I use VAR.S or VAR.P?

+

Use VAR.P only when the data includes every member of the group you are describing, such as every employee on one team. If the data is part of something bigger, or you are not sure, use VAR.S.

What is the difference between variance and standard deviation?

+

Standard deviation is the square root of variance. Variance is in squared units, such as tickets squared, while standard deviation is in the original units, which makes it easier to explain.

Why does VAR.S return #DIV/0!?

+

VAR.S needs at least two numbers, because it divides by n minus 1. Check that the range holds real numbers and not numbers stored as text, which VAR.S ignores.

Is VAR the same as VAR.S?

+

Yes. VAR is the older name for sample variance and gives the same result as VAR.S. VARP gives the same result as VAR.P. The older names still work for compatibility.

Sources

  • AVERAGE function - Microsoft Support
  • SUMPRODUCT function - Microsoft Support
  • SQRT function - Microsoft Support

Written and checked by the ExcelReady Team. First published November 3, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. What is variance?
  2. How to calculate variance with VAR.S and VAR.P
  3. VAR.S or VAR.P: which should you use?
  4. How to calculate variance by hand
  5. Variance and standard deviation
  6. Other variance functions and versions
  7. Common variance mistakes
  8. Practise it

Keep reading

Comparisons· 7 min read

STDEV.S vs STDEV.P: Sample or Population?

Use STDEV.S when your numbers are a sample taken from a bigger group, such as six weeks out of a year. Use STDEV.P when your numbers are the whole group you care about, such as every person on one team. STDEV.S divides by n minus 1, so it always gives a slightly larger result. When in doubt, use STDEV.S.

Math· 7 min read

How to Calculate Standard Deviation in Excel

To calculate standard deviation in Excel, use =STDEV.S(B2:B7) when your data is a sample, or =STDEV.P(B2:B7) when it covers the whole group you care about. Standard deviation measures how far values typically sit from the average. A small result means the values are close together; a large one means they are spread out.

Math· 5 min read

AVERAGE, MIN and MAX in Excel With Examples

AVERAGE returns the mean of a range, MIN returns the smallest number and MAX returns the largest. All three take the same input: =AVERAGE(B2:B6), =MIN(B2:B6) and =MAX(B2:B6). They skip empty cells and text but count zeros, and =MAX(B2:B6)-MIN(B2:B6) shows how spread out the values are.

More on math

  • WACC Formula in Excel: Weighted Average Cost of Capital
  • How to Calculate a Weighted Average in Excel
  • Year-Over-Year Growth in Excel: Formula, Table and Pivot
  • Calculate a Z-Score in Excel With STANDARDIZE
  • A/B Test in Excel: Compare Conversion Rates and Significance
  • Absolute References and the $ Sign in Excel
All math articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free