Applies ToAccess for Microsoft 365 Access 2024 Access 2021 Access 2019 Access 2016

Return estimates of the variance for a population or a population sample represented as a set of values contained in a specified field on a query.

Syntax

Var ( expr )

VarP ( expr )

The expr placeholder represents a string expression identifying the field that contains the numeric data you want to evaluate or an expression that performs a calculation using the data in that field. Operands in expr can include the name of a table field, a constant, or a function (which can be either intrinsic or user-defined but not one of the other SQL aggregate functions ).

Remarks

The VarP function evaluates a population, and the Var function evaluates a population sample.

If the underlying query contains fewer than two records, the Var and VarP functions return a Null value, which indicates that a variance cannot be calculated.

You can use the Var and VarP functions in a query expression or in an SQL statement.

Query example

Expression

Results

SELECT Var(UnitPrice) AS Var,VarP(UnitPrice) as VarP FROM productSales;

Calculates the Variance of "UnitPrice" considering the given data as sample and Variance of "UnitPrice" considering the given data as entire population and displays the results in Var and VarP respectively.

Calculating Fields in SQL Functions

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.