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. |
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). There are AVERAGE extensions for use with Data Grids and Data Sets (see below). |
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.
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 of cells, 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>)
You can enter the last field first and the first field last if required—ClearSCADA will still recognize the required range.
Examples 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, and including, the A1 cell and the B9 cell in its calculation. If we assume that A1 is the 1st 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 (comprising the cells between, and including, 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.
Further Information
For another example that demonstrates how the AVERAGE function might be used with Data Grids, see Example Configuration in the ClearSCADA Guide to Core Configuration.
The AVERAGE function has been extended for use with Data Sets. It can support blocks of fields (arrays) as well as numerical values. This means that you can use fields instead of numerical values in the AVERAGE function (or you can use a combination of blocks of fields, single fields and numbers as required).
Syntax
AVERAGE(<Field1>, <Field2>, <Field3>...)
Where <Field1>
is the name of a field in a Data Set Row, <Field2>
is the name of another field in the Data Set Row and so on. Do not enter the angle brackets < >.
For blocks of fields, you have to define the first field and the last field in the range and separate them with a colon:
AVERAGE(<FirstFieldinRange>:<LastFieldinRange>)
You can enter the last field first and the first field last if required—ClearSCADA will still recognize the required range.
Examples when used with Data Sets:
AVERAGE(A:H)
Where A defines the first field to be used and H defines the last field to be used. The AVERAGE function will use the data from the fields between, and including, fields A to H in its calculation. If we assume that A is the 1st field and H is the 8th field, the AVERAGE function will use the values from fields 1-8 inclusive in its calculation.
AVERAGE(A:H, 3, 75, R, K, P)
Where A:H defines a block of fields (comprising the fields between, and including, the fields A to H), 3 and 75 define numerical values, R, K, and P define individual fields. The AVERAGE function will use the numerical values and the values from the defined fields (including the fields in the block) in its calculation.