DAvg Function (SQL Only)

See AlsovbfctDAvgSee                 ExamplevbfctDAvgEx>Low


Returns the arithmetic mean of a set of values in a specified set of records (domainCQNETL).


DAvg( expr, domain [, criteria] )


The DAvg function uses the following arguments.

Argument        Description


expr                 String expression1330R89 identifying the field that contains the numeric data you want to average, or an expression that performs calculations using the data in that field.  Operands in expr can include the name of a table field, or a Visual Basic function (which can be intrinsic but not a user-defined function or one of the other domain aggregate or SQL aggregate functions).

domain             String expression identifying the records that constitute the domain.  It can be a table name, a query name, or an SQL expression that returns data.

criteria              Optional string expression used to restrict the range of data on which DAvg is performed.  For example, criteria could be the WHERE clause in an SQL expression (without the word WHERE).  If criteria is omitted, DAvg evaluates expr against the entire domain.


The average calculated by DAvg is the arithmetic mean (the sum of the values divided by the number of values).  You might use DAvg to calculate average freight cost.

If the criteria argument contains non-numeric text other than field names, you must enclose the text in single quotation marks.  In the following examples, Ship Country is the name of a field, and UK is a string literal.

X = DAvg("[Freight]", "Orders", "[Ship Country] = 'UK'")

Y = DAvg("[Freight]", "Orders", "[Ship Via] = 1")


Records that contain Null fields aren't included in the calculation.