Estimates the how much dispersion exists (how much the values are spread out) within a sample set of data. This aggregate function calculates the variance of the numeric values in the reference column (the column to which var is applied) among those rows that are identical.

All duplicate rows are discovered by conducting a column-by-column examination (excluding the column to which var is being applied) before they are collapsed into unique single rows. For each resulting single row, the value in the reference column from the contributing duplicate row becomes part of the variance calculation. The header of the reference column receives a name change to become “Var of <*column name*>”.

If there are text values in the reference column, they will be ignored within the varcalculation. Note also that the aggregate var function requires at least two values. In other words, there must be at least two identical rows available for aggregation for each unique single row that is returned. Rows that occur only once will contribute only one value in the reference column for the calculation—resulting in an error.

If the set under analysis represents all data points (referred to as a “population”) use of varp is recommended for a more accurate result. Related functions that deal with statistical variance are stdev and stdevp.

## Example

The dataset below will be used to show how var operates. All numbers are numeric values (not text) in order to illustrate behavior of this aggregate function.

Column A | Column B | Column C |
---|

one | two | 0.2 |

one | two | 0.1 |

one | two | 1.1 |

one | two | 0.2 |

one | two | 0.6 |

one | one | 0.2 |

one | one | 0.27 |

one | two | 0.2 |

one | two | 0.4 |

As shown in the table below, applying the var function to *Column C* reduces the row count from nine to two. The value in the column *Var of Column C* shows the variance of the*Column C* sample data values in the duplicate rows that were collapsed during the operation.

Column A | Column B | Var of Column C |
---|

one | two | 0.12333333333333334 |

one | one | 0.00245 |