How to Use the VAR Function in Google Sheets

Published on

The VAR function in Google Sheets is a statistical function used to calculate the variance of a sample. Its modern equivalent is VAR.S, where the “S” stands for “sample.”

Functionally, VAR and VAR.S are identical—they use the same arguments and return the same result. The main difference is that VAR.S is the newer, standardized version of the function. Google Sheets retains VAR for backward compatibility.

So, which one should you use?
Use VAR.S whenever possible, as it clearly indicates that the variance is being calculated for a sample, not a full population.

Understanding Variance (Before Using the Function)

Before diving into the formula, let’s quickly understand what variance means.

Variance measures how far a set of numbers are spread out from their average (mean). It’s closely related to standard deviation. In fact:

Variance = (Standard Deviation)²

To calculate variance:

  1. Find the average of your data.
  2. Calculate the squared differences from the average for each value.
  3. Take the average of those squared differences.

If you’re working with a population, divide by N (the number of values).
If you’re working with a sample, divide by N-1.

Manual Variance Calculation (Example)

Let’s manually calculate the variance of a sample dataset before using the formula.

Sample Data: Height of 10 Students (in cm)

StudentHeight
Esha160
Farhan155
Harsha140
Alex148
Daisy147
Hannah130
Julia162
Ayesha168
Noor139
Mark138
Total1487

Step 1: Calculate the Mean

Mean=1487/10 = 148.7

Step 2: Calculate Squared Differences from the Mean

=(160-148.7)^2+(155-148.7)^2+(140-148.7)^2+(148-148.7)^2+(147-148.7)^2+(130-148.7)^2+(162-148.7)^2+(168-148.7)^2+(139-148.7)^2+(138-148.7)^2 = 1354.1

Step 3: Calculate Variance

  • Population variance:

1354.1/10 = 135.41

  • Sample variance:

=1354.1/9 = 150.46

So the variance of this sample is 150.46.

VAR and VAR.S Syntax in Google Sheets

VAR Function

VAR(value1, [value2, ...])

VAR.S Function

VAR.S(value1, [value2, ...])

Arguments:

  • value1: Required. The first value or range representing the sample.
  • value2: Optional. Additional values or ranges to include in the sample.

Note: You can’t use just a single value like =VAR(160)—this will return a #DIV/0! error. Instead, use a range like =VAR(A1:A10).

Example: Using VAR and VAR.S in Google Sheets

Let’s now calculate the variance of the same student height data using both functions.

If your height values are in cells B3:B12, then:

=VAR(B3:B12)
=VAR.S(B3:B12)

Both formulas return: 150.46

Example showing the use of VAR and VAR.S functions to calculate sample variance in Google Sheets

You can scroll up and compare this result with our manual calculation—it matches!

Usage Notes for VAR and VAR.S in Google Sheets

Keep the following points in mind when using VAR or VAR.S in Google Sheets:

  • Blank cells are ignored.
  • Zero values are included.
  • Text values in the range are treated as blanks and ignored.

For example:

  • If cell B6 is blank, the variance result will change.
  • If cell B6 is 0, it will be included in the calculation and lower the variance.

You can observe this behavior by testing different values in the range.

Final Thoughts on VAR and VAR.S Functions

The VAR and VAR.S functions in Google Sheets make it easy to calculate the variance of a sample dataset without manual computation. While both functions return the same results, it’s best practice to use VAR.S for clarity and modern compatibility.

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Expert Prashanth KV is a Diamond Product Expert in Google Sheets, officially recognized by Google for his contributions to the Docs Editors Help Community and featured in the Google Product Experts Directory. Explore his blog to learn advanced formulas, automation tips, and problem-solving techniques to elevate your spreadsheet skills.

Top Discussions

More like this

Free Student Grade Tracker Template in Google Sheets

If you are looking for a simple way to track student grades, you are...

Free Monthly Expense Tracker Template in Google Sheets (Dashboard Included)

Watch the quick walkthrough below to see how to use this Free Monthly Expense...

The Complete Guide to XLOOKUP in Google Sheets (15+ Practical Examples)

The XLOOKUP function largely replaces traditional lookup functions such as LOOKUP, VLOOKUP, and HLOOKUP...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.