AVERAGE
The AVERAGE function is a mathematical function that returns the mean average of a set of values. The average value is a real value.
Function Name |
AVERAGE. |
Description |
Returns the mean average of a set of values. There is an AVERAGE extension for use with Data Grids (see below). |
Arguments |
AVERAGE(INTEGER or REAL, INTEGER or REAL, INTEGER or REAL...) The values in the set of values have to be separated by commas and they can be integers or real floating values. For information on integers and real floating values—see Number (Integer or Real). |
Returns |
The mean average of the set of input values. The data type is the same as that of the input values (integer or real). |
Example:
AVERAGE(2, 3, 4, 1)
The output is 2.5.
AVERAGE Extension for Data Grids Only
The AVERAGE function has been extended for use with Data Grids. It can support blocks of cells (arrays) as well as numerical values. This means that you can use fields and rows instead of numerical values in the AVERAGE function (or you can use a combination of blocks, single cells and numbers as required).
Syntax
AVERAGE(<Field1><Row1>, <Field2><Row1>, <Field3><Row1>...)
Where <Field1><Row1> is the name of a field in a row, <Field2><Row1> is the name of another field in the row and so on. Do not enter the angle brackets < >.
For blocks of cells, you have to define the first field and row and the last field and row in the range and separate them with a colon:
AVERAGE(<FirstFieldinRange><FirstRowinRange>:<LastFieldinRange><LastRowinRange>)
NOTE: You can enter the last field first and the first field last if required—ClearSCADA will still recognize the required range.
Examples of AVERAGE when used with Data Grids:
AVERAGE(A1:B9)
Where A1 defines the first cell to be used and B9 defines the last cell to be used. The AVERAGE function will use the data from the cells between the A1 cell and the B9 cell in its calculation. If we assume that A1 is the first cell in a field named A and B9 is the 9th cell in a field named B, the AVERAGE function will use the values from the cells in field A and the values from cells 1-9 inclusive from field B in its calculation.
AVERAGE(A1:B9, 3, 75, C6, C8, D11)
Where A1:B9 defines a block of cells (the cells between the A1 cell and the B9 cell), 3 and 75 define numerical values, C6, C8, and D11 define individual cells. The AVERAGE function will use the numerical values and the values from the defined cells (including the cells in the block) in its calculation.