The Excel DVAR Function

Related Function:
Excel Database Functions

The Excel Database Functions are designed to assist you when working with an Excel database.

A database typically takes the form of a large table of data, where each row in the table stores an individual record. Each column in the spreadsheet table stores a different field (or type of information) for each record.

The database functions perform basic operations, such as count, max, min, etc, but they enable the user to specify criteria, so that the operation is performed on selected records only. Other records in the database are ignored.

Function Description

The Excel Dvar function calculates the sample variance of a field (column) in a database for selected records only. The records to be included in the calculation are defined by a set of one or more user-specified criteria.

The syntax of the function is:

DVAR( database, field, criteria )

where the arguments are:

database-A range of cells containing the database. The top row of the database should specify the field names.

The field (column) within the database, for which the sample variance is to be calculated.

This can either be a field number, or it can be the field name (i.e. the header in the top row of the database) encased in quotes (e.g. "Subject", "Name", etc).


A range of cells that contain the criteria, to specify which records should be included in the calculation.

The range can include one or more criteria, which are presented as a field name in one cell and the condition for that field in the cell below.



The Excel Database functions allow the following wildcards to be used in text-related criteria:

?    -    matches any single character
*    -    matches any sequence of characters

(If you actually want to find the ? or * character, type the ~ symbol before this character in your search).

E.g. the condition "a*e" will match all cells containing a text string beginning with "a" and ending in "e".

The criteria supplied beneath each field heading can be either:


Note that the Excel database functions are not case sensitive. So, for example, the criteria ="Name" will be satisfied by cells containing the text "Name" or "name".

Excel Dvar Function Examples


The following examples are based on the above simple database on the right, which stores the examination marks scored by four children in three different subjects.

Example 1

In the example below, the Dvar function is used to find the sample variance of scores obtained in Science, by male children. The criteria are specified in cells G1 - H2 and the Dvar formula is shown in cell G3.

3=DVAR( A1:E13, "Score", G1:H2 )

The above Dvar function calculates the sample variance of the values in cells E5, E8 & E11, and therefore returns the value 3.8%.

Example 2

In the example below, the Dvar function is used to find the sample variance for the Science scores obtained by students over 8 years of age.

3=DVAR( A1:E13, "Score", G1:H2 )

The above Dvar function finds the sample variance of the values in cells E4, E10 & E13 and so returns the value 1.7%.

Note that, in the above two examples, instead of typing in "Score" for the field argument, we could have simply used the number 5 (to denote the 5th column of the database).

For further examples of the Excel Dvar function, see the Microsoft Office website.