DStdev and DStdevP Access Functions


DStDev Standard Deviation Function

DStDevP Population Standard Deviation Functions in Access

StDev Function & StDevP Function – calculate the sample (recordset) standard deviation and an estimate of the population standard deviation. It is nice to have some statistical measures immediately available to you with a single command.With the standard deviation, count, and mean you can generate a large number of statistical functions such as correlation coefficients.  Combine these with the histogram example and you can also figure out kertosis and skewness.  You can create your own custom functions which can be called directly from an Access SQL query for the more advanced statistical measures. Below is a simple example that calculates the sample and population standard deviation for the quantity shipped field.

Sample standard deviation code is the record source for the unbound field in the form footer:


The population statistic is as follows:


Note that each of the statistical measure work on the entire Shipping table and ignores any filtering done on the form.

In the following example we restrict the calculations to only include those quantities for FedEx shipments:

The sample StDev standard deviation function code is as follows:


And, the StDevP population standard deviation function calculation is similar:


To restrict the calculations to a subset of the shipping table records use a query as the source for the form and restrict the query based on a form field. Refer to the query name rather than the table name ‘shipping’ in the Dstdev code.


Microsoft Office VBA, MS Access 2003, 2007, 2010, 2013, 2016