VAR Function in Excel
The VAR function calculates sample variance in Excel. Learn the legacy VAR syntax, when to use it vs VAR.S, and how to upgrade for modern Excel compatibility.
=VAR(number1, [number2], ...)Quick Answer
VAR function VAR function is Excel's legacy formula for calculating sample variance, measuring how far numbers spread from their average value squared. While still supported in modern Excel for backward compatibility, VAR has been replaced by VAR.S (sample variance) and VAR.P (population variance) since Excel 2010. Use the syntax `=VAR(number1, [number2], ...
Practical Examples
Basic Sales Variance Calculation
Calculate monthly sales variability using legacy VAR function
Legacy Workbook Compatibility
Maintaining variance formulas for Excel 2007 compatibility
Comparing VAR to VAR.S Results
Demonstrating functional equivalence between VAR and VAR.S
Financial Analysis with VAR
Portfolio return variability using legacy variance function
Google Sheets VAR Usage
Using VAR in Google Sheets environment
Common Errors and Solutions
Division by zero error
The function received fewer than 2 numerical values. Variance requires at least 2 data points to calculate dispersion. With only 1 value or all empty/text cells, there's no variability to measure.
Verify your range contains at least 2 numeric values. Use COUNT to check: =IF(COUNT(A1:A10)>=2, VAR(A1:A10), "Need at least 2 values"). Check for empty cells, text entries, or hidden rows that might reduce your dataset below 2 values.
Add conditional logic: =IF(COUNT(B2:B100)>=2, VAR(B2:B100), "Insufficient data for variance")
Example:
Invalid value type
The range contains error values (#N/A, #REF!, #NAME?, etc.) that cannot be converted to numbers. Unlike empty cells (which VAR ignores), error values cause the entire function to fail.
Clean your data by wrapping source calculations in IFERROR: =VAR(IFERROR(A1:A10,"")). This converts errors to empty cells which VAR ignores. Alternatively, use array formulas to filter: =VAR(IF(ISNUMBER(A1:A100),A1:A100)) (Ctrl+Shift+Enter in older Excel).
Systematically wrap all source data: =VAR(IFERROR(SourceData,"")) to prevent error propagation
Example:
Unclear whether sample or population variance is intended
VAR doesn't explicitly indicate it's calculating sample variance (n-1 denominator). This can confuse users who don't know whether they're looking at sample or population calculations, especially when comparing to other workbooks using VAR.P.
In Excel 2010+, replace VAR with VAR.S to make your intent explicit. Use Find & Replace: Find "=VAR(" and Replace with "=VAR.S(". This clarifies you're calculating sample variance and aligns with modern Excel statistical function conventions.
Always use VAR.S in new formulas (Excel 2010+) instead of VAR. Reserve VAR only for legacy workbook compatibility.
Example:
Formula doesn't work in Excel 2007 or earlier
If you use VAR.S (the modern replacement for VAR), workbooks won't open correctly in Excel 2007 or earlier versions because VAR.S didn't exist before Excel 2010.
For maximum compatibility with older Excel versions, keep using VAR instead of upgrading to VAR.S. Add documentation noting the Excel 2007 compatibility requirement. Alternatively, maintain two versions: one with VAR for legacy support, one with VAR.S for modern Excel.
Before distributing workbooks, confirm target audience's Excel version. If anyone uses Excel 2007 or earlier, document this and keep VAR functions.
Example:
Best Practices and Pro Tips
Upgrade to VAR.S in Modern Excel
If you're using Excel 2010 or later, migrate from VAR to VAR.S for all new formulas. VAR.S provides explicit clarity about calculating sample variance, aligns with modern Excel statistical function naming conventions, and makes your statistical intent immediately obvious to anyone reviewing your work.
Document Legacy VAR Usage
If maintaining VAR functions for Excel 2007 compatibility, add clear documentation: "Using VAR (instead of VAR.S) for Excel 2007 compatibility" as a cell comment or in workbook documentation. This prevents future confusion about why you're using the older function.
VAR vs VAR.S: Functionally Identical
Remember that VAR and VAR.S produce identical results in Excel 2010+. Both use the formula Σ(x - x̄)² / (n-1). The only difference is naming clarity. When reviewing formulas, treat VAR as VAR.S for analysis purposes, but consider upgrading to VAR.S for improved code clarity.
Google Sheets Equivalence
In Google Sheets, VAR and VAR.S are completely interchangeable - the system handles both identically with no differences in behavior or results. However, using VAR.S is still recommended for consistency with Excel best practices and to make your statistical intent explicit.
Variance Interpretation: Convert to Standard Deviation
Whether using VAR or VAR.S, variance is in squared units (dollars², points², etc.), making it hard to interpret. For better understanding, convert to standard deviation: =SQRT(VAR(range)) or use STDEV/STDEV.S directly. Standard deviation returns results in original units, making the variability magnitude much clearer.
Batch Migration Strategy
When upgrading workbooks from Excel 2007 to modern versions, use Find & Replace to batch convert VAR to VAR.S: Find "=VAR(" and Replace with "=VAR.S(". Test thoroughly afterward, though results will be identical. This modernizes your statistical formulas and improves clarity for future users.
Don't Confuse with VAR.P
VAR calculates sample variance (like VAR.S), not population variance (like VAR.P). If you need population variance, you must explicitly use VAR.P or VARP (legacy version). VAR will always divide by n-1, never by n. This is one reason why VAR.S/VAR.P naming is clearer than the ambiguous VAR.
Excel Function Wizard Guidance
In Excel 2010+, the function wizard (fx button) shows VAR.S and VAR.P prominently while relegating VAR to "compatibility functions." This is Microsoft's way of encouraging migration to the clearer naming system. Follow this guidance in new work.
Consistency Across Statistical Functions
For statistical consistency, if you're using VAR, also use matching legacy functions: STDEV (not STDEV.S), AVERAGE stays the same. If using VAR.S, pair it with STDEV.S, COVARIANCE.S, etc. Mixing legacy and modern function families creates confusion about statistical approach.
Performance: No Difference
VAR and VAR.S have identical performance characteristics - both execute with the same speed and efficiency. The choice between them is purely about clarity and modern best practices, not performance. Don't worry about speed differences when migrating.
Need Help with VAR Function in Excel?
Stop struggling with formula syntax. Use AskFormulas to generate validated formulas instantly with our AI-powered tool.
Example Excel formula:
Related Formulas
Master the AVERAGE function with practical examples and error solutions. Learn to calculate mean values and analyze data efficiently in Excel and Sheets.
Calculate sample standard deviation in Excel with STDEV.S. Learn syntax, examples, and solutions to common errors for statistical analysis in spreadsheets.
Calculate population variance in Excel with VAR.P. Learn syntax, examples, and when to use population vs sample variance for complete statistical analysis.
Calculate sample variance in Excel with VAR.S. Master variance analysis with syntax, examples, and solutions for statistical data analysis in spreadsheets.