VAR.S Function in Excel
Calculate sample variance in Excel with VAR.S. Master variance analysis with syntax, examples, and solutions for statistical data analysis in spreadsheets.
=VAR.S(number1, [number2], ...)Quick Answer
VAR.S function VAR.S function calculates the variance of a sample dataset in Excel and Google Sheets. It measures how far numbers spread from their average value squared, providing a statistical measure of data dispersion. Use the syntax `=VAR.S(number1, [number2], ...)` where number1 is your required data range containing at least 2 values.
=VAR.S(number1, [number2], ...)Practical Examples
Monthly Revenue Variability
Calculate how much monthly revenue varies from the average
Quality Control Precision
Measure manufacturing precision using variance
Test Score Distribution Analysis
Compare variability between two assessment methods
Portfolio Risk Calculation
Calculate investment risk using monthly return variance
Customer Satisfaction Spread
Measure how much satisfaction ratings vary across customers
Process Improvement Tracking
Compare variance before and after process changes
Common Errors and Solutions
Division by zero
The function received fewer than 2 numerical values. Variance requires at least 2 data points to calculate dispersion from the mean. With only 1 value, there's no way to measure variability.
Verify your range contains at least 2 numeric values. Check that cells aren't empty, contain errors, or have only text values. Use COUNT to verify: =IF(COUNT(A1:A10)>=2, VAR.S(A1:A10), "Need at least 2 values"). When working with filtered data, ensure at least 2 values remain visible after filtering.
Add conditional logic before calculating variance: =IF(COUNT(B2:B100)>=2, VAR.S(B2:B100), "Insufficient data for variance calculation")
Example:
Wrong value type
The function encountered an argument that cannot be converted to a number, such as error values (#N/A, #REF!, #NAME?) within the data range, or text that doesn't represent numbers. VAR.S ignores text cells but will error if errors are present.
Clean your data by removing or fixing error values first. Use IFERROR wrapper around source calculations to convert errors to blanks. Alternatively, use array formulas with IF to filter out problematic values: =VAR.S(IF(ISNUMBER(A1:A100),A1:A100)). Remember to press Ctrl+Shift+Enter for array formulas in older Excel versions.
Wrap source data in IFERROR: =VAR.S(IFERROR(A1:A10,"")). This converts errors to empty cells which VAR.S ignores. For more robust handling: =IF(COUNTA(IFERROR(A1:A10,""))>=2, VAR.S(IFERROR(A1:A10,"")), "Error in data")
Example:
Invalid numerical operation
All provided values are identical, resulting in zero variance. While mathematically valid (variance = 0 when all values are the same), some Excel versions may return #NUM! in edge cases, particularly with circular reference detection enabled or in specific calculation modes.
Check if all values in your range are identical using =COUNTA(UNIQUE(A1:A10)). If only 1 unique value exists, variance of 0 is correct and expected. If this is unexpected, verify you're referencing the correct range and that data has been entered correctly. Consider whether zero variance is meaningful for your analysis.
Handle uniform datasets gracefully: =IF(COUNTA(UNIQUE(A1:A10))>1, VAR.S(A1:A10), 0). This explicitly returns 0 for uniform data instead of potentially triggering errors.
Example:
Unexpected or seemingly wrong variance value
Common causes include: (1) Confusing VAR.S with VAR.P - VAR.S gives slightly higher values; (2) Including header rows in the range; (3) Hidden rows containing outliers that dramatically increase variance; (4) References to entire columns picking up unexpected data; (5) Mixing different units or scales in the same calculation.
1) Confirm you're using the correct function (VAR.S for samples, VAR.P for populations). 2) Exclude header rows from your range. 3) Unhide all rows to see complete data. 4) Use specific cell ranges (A2:A100) instead of entire columns (A:A). 5) Visually inspect data for outliers that legitimately increase variance. 6) Compare with manual calculation for a small subset to verify. 7) Check units are consistent.
Always use specific, well-defined ranges that exclude headers. Create supporting columns to identify outliers: =IF(ABS(A2-AVERAGE($A$2:$A$100))>2*SQRT(VAR.S($A$2:$A$100)),"Potential outlier",""). Review flagged values before finalizing analysis.
Example:
Variance value seems too large or doesn't make sense
Variance is in squared units, making it harder to interpret than standard deviation. For example, if measuring dollars, variance is in dollars². A variance of 10,000 dollars² sounds enormous but equals a standard deviation of $100, which may be quite reasonable depending on context.
Convert variance to standard deviation for easier interpretation: =SQRT(VAR.S(A1:A100)). This returns the result in original units. For example, if variance is 625 mm², standard deviation is 25 mm. Use variance for calculations (it's additive and mathematically convenient) but report standard deviation for communication.
Always present both variance (for technical analysis) and standard deviation (for interpretation): "Variance = 10,000 dollars² (Standard Deviation = $100)". This helps stakeholders understand the actual magnitude of variability.
Example:
Best Practices and Pro Tips
Variance vs Standard Deviation: When to Use Which
Use variance for mathematical calculations (it's additive, making portfolio variance or ANOVA easier) but present results as standard deviation for interpretation (original units are more intuitive). Formula: SD = √Variance. For example, calculate portfolio variance by adding individual asset variances, then convert final result to standard deviation for reporting.
Combining Multiple Ranges
You can calculate variance across non-contiguous ranges by listing them separately. This is particularly useful when comparing departments, time periods, or categories stored in different worksheet areas. VAR.S treats all ranges as one unified dataset, which is perfect for consolidated variance analysis.
Sample Size Matters Even More for Variance
Variance estimates are less stable than mean estimates, especially with small samples. With fewer than 20 data points, your variance estimate may be quite unreliable. For samples under 30, always report the sample size alongside variance. Larger samples (n>100) provide much more stable variance estimates that better represent population variability.
ANOVA and Variance Decomposition
Variance can be decomposed into components: Total Variance = Between-Group Variance + Within-Group Variance. This is the foundation of ANOVA (Analysis of Variance). Use VAR.S to calculate variances within each group, then compare to overall variance to understand how much variability is due to group differences vs random variation within groups.
Variance in Finance: Portfolio Risk
In portfolio management, variance is additive for uncorrelated assets. Total portfolio variance = w1²×σ1² + w2²×σ2² + 2×w1×w2×Cov(1,2), where w = weights, σ² = variances, and Cov = covariance. This property makes variance mathematically convenient for risk calculations, though you'll convert to standard deviation (volatility) for final reporting.
Excel vs Sheets Compatibility
VAR.S works identically in Excel (2010+) and Google Sheets with the same syntax and results. For older Excel versions (2007 and earlier), use VAR instead. In Google Sheets, VAR and VAR.S are equivalent. When sharing files between platforms, VAR.S ensures consistent behavior and clear communication that you're calculating sample variance.
Coefficient of Variation for Relative Variability
To compare variability between datasets with different scales or units, calculate the coefficient of variation (CV): (Standard Deviation / Mean) × 100 = (√Variance / Mean) × 100. This expresses variability as a percentage of the mean, making it scale-independent. CV = 15% means variability is 15% of average value.
Variance and the Empirical Rule
For normally distributed data, variance helps define probability ranges. With variance σ², approximately 95% of values fall within ±2σ of the mean (where σ = √variance). This means ±2×SQRT(VAR.S(data)) captures most data points. Values beyond ±3σ (99.7% threshold) are potential outliers deserving investigation.
Don't Mix Sample and Population Functions
Using VAR.S when you have population data (or VAR.P for sample data) leads to incorrect statistical conclusions. VAR.S always gives slightly higher values than VAR.P for the same data because it divides by n-1 instead of n. Use VAR.S (sample variance) unless you're absolutely certain you have every member of the population with no need to generalize.
Handling Outliers in Variance Calculations
Variance is heavily influenced by outliers because it squares deviations (a value 10 units away contributes 100 to variance). Before calculating variance, identify and investigate outliers using: =IF(ABS(A2-AVERAGE($A$2:$A$100))>3*SQRT(VAR.S($A$2:$A$100)),"Outlier","Normal"). Decide whether to include, exclude, or investigate outliers based on context and whether they represent valid data or errors.
Need Help with VAR.S 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.
Master the MEDIAN function to find the middle value in datasets. Learn syntax, practical examples, and error solutions for statistical analysis.
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.