How to Calculate Variance in Excel: Step by Step
In this article
To determine variance in Excel, use the built-in functions rather than doing the math by hand: =VAR.S(range) for a sample and =VAR.P(range) for an entire population, then press Enter. Excel returns a single number that tells you how spread out your values are. Anything else — the long formula, the square-root version for standard deviation, or the population versus sample confusion — is easier once you know which of the two functions matches your data. The steps below walk through both, plus how to read the result and where people usually go wrong with network and device performance data.
What You'll Need
- A spreadsheet program that supports modern functions: Excel for Microsoft 365, Excel 2021, Excel 2019, Excel 2016, or the free web version. The older VAR function still works but is kept only for backward compatibility.
- Your numbers in a single column or row, ideally with a header cell above them so you can select the range confidently.
- A clear idea of whether your data is a sample or a whole population — this decides which function you call.
- Optional but useful: a second column of labels (dates, device names, room names) so you can keep track of which reading belongs to which point.
Step-by-Step
- Lay out your data. Put the values you want to measure in one continuous block. For example, put router signal strength readings in A2 through A31, with a label in A1. Do not leave blank rows inside the block — a blank cell is skipped, and a hidden text value will throw an error.
- Decide sample or population. Use the sample function if your numbers are a subset of a larger set you want to describe — for instance, ten speed tests out of hundreds you could have run. Use the population function if you have every value that exists: every device on your network, every room in the house, every day in the billing period. When in doubt, choose sample; it is the more conservative choice.
- Click an empty cell below or beside your data, where the result should appear.
- Type the function. For a sample, type
=VAR.S(and then drag to select your range, or type the range directly, for example=VAR.S(A2:A31). For a population, type=VAR.P(A2:A31). - Press Enter. The cell shows the variance as a decimal number. Variance is in squared units, so if your readings are in Mbps the result is in Mbps squared — which is why the number looks large.
- Check for errors. If you see
#DIV/0!you have fewer than two numeric values (sample) or no values at all (population). If you see#VALUE!or#NAME?, a cell contains text or the function name is mistyped — see Troubleshooting below. - Convert to standard deviation if you want readable units. Put
=STDEV.S(A2:A31)or=STDEV.P(A2:A31)next to the variance. Standard deviation is the square root of variance and comes back in the same units as your data, which is often the number people actually want. Check that you pair the sample variance with the sample standard deviation, and population with population. - Label the result. Type "Sample variance" in the cell to the left so the number means something later. It is easy to forget which of the two functions you used once the sheet is a week old.
- Add context with mean and count. Put
=AVERAGE(A2:A31)and=COUNT(A2:A31)nearby. Variance alone is hard to interpret without knowing the average and how many readings went into it. - Copy the formula down for several columns. If you are comparing rooms, devices or days side by side, drag the fill handle from the bottom-right corner of the result cell. The range references adjust automatically, so each column gets its own variance.
- Format the output. Right-click the result cell, choose Format Cells, and set a sensible number of decimal places. Raw variance often has many digits and is unreadable at full precision.
- Recheck the range. Click the result cell and press F2 to see exactly which cells the formula covers. A range that accidentally includes the header or the total row is the single most common reason a variance figure looks wrong.
Common Mistakes
Using VAR.P when the data is a sample. The population function divides by the number of values, while the sample function divides by one fewer. On small samples the difference is large — with five values it can be 20 percent or more. If you took readings on a handful of days and want to infer something general, that is a sample.
Confusing variance with standard deviation. Variance is squared; standard deviation is the square root of it. Reporting a variance of 144 when the standard deviation is 12 tells the wrong story. Decide which one your audience needs before you publish the figure.
Including headers or totals in the range. Selecting A1:A31 when A1 says "Speed" and A31 is a sum both corrupts and distorts the answer. Confirm the range with F2 after entering the formula.
Letting text masquerade as numbers. Values imported from a router log or a web portal often come in as text, sometimes with a trailing space. VAR.S ignores text inside a range, so your count silently drops and the result is based on fewer numbers than you think. Compare COUNT against the number of rows to spot this.
Using the old VAR function without knowing it. VAR behaves like VAR.S but exists only for compatibility. New sheets should use the dot-suffixed names so the intent is clear.
Treating variance as a quality score. High variance is not automatically bad. A sensor that sometimes reads high and sometimes low has high variance; whether that matters depends on what you are measuring.
Tips
Keep a small example block you can test a formula against: numbers 2, 4, 4, 4, 5, 5, 7, 9 have a population variance of exactly 4 and a sample variance of about 4.57. If your formula reproduces those, it is wired up correctly.
Use a named range or an Excel Table so your formula keeps working when you add rows. Right-click the result and insert a comment recording the function, range and date — future you will thank present you.
When comparing devices or rooms, calculate variance in a single consistent unit. Mixing dBm and percentage, or bytes and bits, makes the comparison meaningless.
For quick exploration, the Data Analysis ToolPak includes a Descriptive Statistics tool that outputs variance and standard deviation together. It must be enabled first through File > Options > Add-ins, and the exact menu wording can differ slightly between versions and platforms.
Troubleshooting
The result is #DIV/0!. The range has fewer than two numbers. Widen the selection or check that your values were not stored as text.
You get #NAME?. The function name is misspelled, or you typed a period instead of using the dot-suffixed name correctly. Older Excel versions before 2010 do not have VAR.S and VAR.P at all — use VAR and VARP there, and note the older file format may also be the reason.
You get #VALUE!. A cell in the range holds an error value. Find it and fix or clear it; one error propagates through the whole calculation.
The answer is zero. Every value in the range is identical, or your range covers a single repeated cell. That is a legitimate result, not a bug.
The answer changes every time you open the file. Your range probably contains volatile formulas or references to external data that refresh. Paste the values in as static numbers if you need a fixed figure.
Text values are being ignored. Use VARA or VARPA only if you genuinely want text counted as zero and TRUE as one. For network readings this is almost never what you want — convert the text to numbers instead.
Frequently Asked Questions
What is the difference between VAR.S and VAR.P?
VAR.S estimates variance from a sample and divides by the count minus one. VAR.P calculates the variance of a complete population and divides by the count. Pick based on whether your data is a subset or the whole set.
How do I calculate variance across two columns or groups?
Run the function once per column, for example =VAR.S(A2:A31) and =VAR.S(B2:B31). If you want a single combined figure, stack the values in one column first.
Can I calculate variance with conditions?
Not with a single built-in variance function. The practical route is to filter or sort your data and calculate on the filtered subset, or use a helper column that flags rows meeting the condition and then point the range at those rows.
Why is my variance so much larger than my values?
Because variance is squared. If readings differ from the average by about 10 units, the variance is roughly 100. Take the square root to get back to the original scale.
Does variance work the same in Google Sheets?
Yes. Google Sheets uses the same VAR.S and VAR.P names with the same syntax, so formulas move between the two without editing.
Can variance be negative?
No. Squared differences are never negative, so a negative result means a formula or range problem, not a real value.