Category: FUNCTION | Updated: 2026-11-22
How to Use the DVAR Function in Google Sheets | Calculate Sample Variance Matching Criteria
Syntax
=DVAR(database, field, criteria)
- database: Specifies the entire cell range of the data, including headers in the first row.
- field: Specifies the header name of the column for which to calculate variance, or its column number from the left.
- criteria: Specifies the cell range containing the filter conditions (headers + condition values).
Practical Example with a Table
Here is an example of calculating the sample variance of daily sales for stores where “Region is Kanto” (specified in criteria range E1:E2) from store sales data (A1:C8).
| Cell Range | Role | Contents |
|---|---|---|
A1:C8 |
Database | Row 1: Region, Store Name, Daily Sales / Rows 2–8: sales data by store |
E1:E2 |
Criteria Range | E1 = Region, E2 = Kanto |
| Formula Cell | Sample Variance Result | =DVAR(A1:C8, "Daily Sales", E1:E2) → Outputs the sales variance for Kanto-region stores |
Common Errors and Notes
- #DIV/0! Error: Occurs when fewer than 2 numeric records (0 or 1) match the criteria, because the denominator (
n-1) becomes 0 or less. - #VALUE! Error: Occurs when the
fieldname does not exist in the first row ofdatabase. - Interpreting Units: Because variance is in squared units of the original numbers, the values become very large.
DSTDEVis better suited for intuitive comparisons.
Frequently Asked Questions
Q. What is the relationship between the DVAR function and the DSTDEV function?
A. Taking the positive square root (SQRT) of the "variance" returned by DVAR gives the "standard deviation" returned by DSTDEV. Use DSTDEV when you want to view spread in the same units as the original data.
Q. How do I calculate variance for an entire population?
A. To calculate the population variance (dividing by n), use the `DVARP` function instead of DVAR.