How to Calculate Variation in Excel (VAR, STDEV & CV)
In this article
Calculating variation in Excel takes just one formula: put your data in a column, then use =VAR.S(range) for sample variance or =STDEV.S(range) for standard deviation. If you want the coefficient of variation (CV), divide the standard deviation by the average. Everything below works in Excel for Microsoft 365, Excel 2019/2021, and the free Excel for the web; exact function names and menu labels can differ slightly between versions, so if a name doesn't autocomplete, check the function list described below.
What You'll Need
- Excel (desktop, web, or mobile) with your data entered in cells
- A column or row of numeric values (text and blank cells will change results, see Common Mistakes)
- Basic familiarity with typing formulas into a cell
Step-by-Step
- Enter your data. Put your numbers in a single column, for example cells A2 through A21, with a header like "Value" in A1.
- Click the cell where you want the result, for example C2.
- Calculate variance. Type
=VAR.S(A2:A21)and press Enter. This is the sample variance. If your data is the entire population (every possible value, not a sample), use=VAR.P(A2:A21)instead. - Calculate standard deviation. In another cell, type
=STDEV.S(A2:A21)(sample) or=STDEV.P(A2:A21)(population). Standard deviation is the square root of variance and is usually easier to interpret because it's in the same units as your data. - Calculate the coefficient of variation (CV). In another cell, type
=STDEV.S(A2:A21)/AVERAGE(A2:A21). This gives variation as a proportion; multiply by 100 or format the cell as a percentage to express it as a percent. - Optionally add context cells. In nearby cells, compute
=AVERAGE(A2:A21),=MIN(A2:A21),=MAX(A2:A21), and=MAX(A2:A21)-MIN(A2:A21)(the range). Together these give a fuller picture of spread. - Format the results. Select the result cells, right-click, and choose Format Cells (or use the Number group on the Home tab) to set a sensible number of decimal places or a percentage format for the CV.
- Use newer function names where available. In current Excel versions, VAR.S/VAR.P and STDEV.S/STDEV.P are the standard names; the older VAR, VARP, STDEV and STDEVP still work for compatibility but the newer ones are preferred.
Common Mistakes
- Confusing sample and population. VAR.S and STDEV.S assume your data is a sample (the usual case); VAR.P and STDEV.P assume it's the entire population. Using the wrong one changes the result slightly, especially with small datasets.
- Including the header or text cells in the range. Text cells are ignored, but including them by accident can shift which numbers are averaged. Select only the numeric cells.
- Blank cells in the middle of the range. Blanks are skipped, which may silently reduce your sample size. Check
=COUNT(A2:A21)to confirm how many numbers Excel is actually using. - Dividing by zero in the CV. If your data's average is zero or near zero, the CV is meaningless or blows up. Don't use CV for data that can be negative or averages near zero.
- Comparing variance across different units. Variance is in squared units (e.g., dollars squared), so it isn't directly comparable across datasets. Use standard deviation or CV for comparisons.
Tips
- Use the keyboard shortcut Alt + = (Windows) to quickly insert common functions, or start typing =STDEV and let Excel's autocomplete suggest the right variant.
- For a quick look without formulas, select the data range and check the status bar at the bottom of the window; right-click it to enable Average, Count, Min and Max. (Standard deviation isn't shown there, but it's a fast sanity check.)
- Convert your data to a Table (Ctrl + T) so ranges expand automatically when you add rows; structured references like Table1[Value] then replace A2:A21.
- If you use the Data Analysis ToolPak (File > Options > Add-ins > Excel Add-ins > Analysis ToolPak), Descriptive Statistics returns variance and standard deviation alongside everything else in one output table.
- Round display only via cell formatting, not the ROUND function inside calculations, so downstream formulas keep full precision.
Troubleshooting
- #NAME? error: Excel doesn't recognize the function name. You likely mistyped it, or you're on an older version that doesn't know VAR.S/STDEV.S — use VAR/STDEV instead.
- #DIV/0! error: Your CV formula is dividing by an average of zero, or your range contains no numbers. Check the range reference and use COUNT to verify numeric entries.
- #VALUE! error: A cell in the range contains text stored as a number-looking string. Re-enter those values as numbers, or check for stray spaces.
- Result looks far too large: You may have calculated variance when you wanted standard deviation, or the range accidentally includes a total or subtotal row. Inspect the range and remove any summary rows.
- Result is zero: All values are identical, or the range points at the wrong cells. Click the result cell and check the highlighted range.
- Numbers stored as text: Select the cells; if you see a small warning triangle, click it and choose Convert to Number. You can also use
=VALUE(cell)to convert individual entries.
Frequently Asked Questions
What's the difference between variance and standard deviation?
Variance is the average of squared deviations from the mean; standard deviation is its square root. Standard deviation is in the same units as your data, which makes it easier to interpret, while variance feeds into many statistical formulas.
Should I use VAR.S or VAR.P?
Use VAR.S when your data is a sample from a larger group (the common case); use VAR.P only when the data represents the entire population. With large datasets the difference is negligible.
What is the coefficient of variation used for?
CV measures spread relative to the mean, letting you compare variability between datasets with different units or scales — for example, comparing the consistency of two different processes. It's only meaningful for data on a ratio scale with a positive mean.
Is there a shortcut to get standard deviation quickly?
Not on the status bar, but the Data Analysis ToolPak's Descriptive Statistics option returns it in one step, and typing =STDEV.S with autocomplete takes only a few seconds.
Do these functions work in Excel for the web and mobile?
Yes. VAR.S, VAR.P, STDEV.S, STDEV.P, AVERAGE, MIN and MAX all work in Excel for the web and in the Excel mobile apps; the Data Analysis ToolPak is desktop-only.
How many data points do I need?
Variance and standard deviation need at least two numeric values. With very few points the estimates are unstable, so treat results from tiny datasets with caution.