averageVal
Returns the average value for a set of numbers.
Important
FUNCTION DEPRECATED — superseded by mean.
Parameters
X (list or table region)
A list or table region of numbers.
DECIMAL PLACES (number)
Optional. The number of decimal places for the result.
Default: Uses your project's default number format pattern.
STRIP TRAILING ZEROS (Boolean)
Optional. Whether to strip trailing zeros from the result (true) or leave them in place (false).
Default: Uses your project's default number format pattern.
Important
In legacy projects, the default for DECIMAL PLACES is 7, and the default for STRIP TRAILING ZEROS is true. For more about legacy projects, see Legacy behaviors.
Examples
Assume the settings in Settings > Number and Currency are:
Setting | Value |
---|---|
LOCALE |
|
NUMBER FORMAT |
|
Examples
If the optional parameters are unspecified, the project settings apply.
ATL in Script | Result |
---|---|
| 4.56 |
Use the second parameter to define the number of decimal places:
ATL in Script | Result |
---|---|
| 5 |
| 4.6 |
Note
Half-up rounding applies automatically.
Set the third parameter to false to include trailing zeros.
ATL in Script | Result |
---|---|
| 4.56 |
| 4.5600 |
Using averageVal with table data
Assume a "Describe the Table" project with this data:
ID | Region | Branch | Sales | |
---|---|---|---|---|
Row 1 | 1001 | Southeast | Atlanta | 357589.32 |
Row 2 | 1002 | Northeast | Boston | 294293.49 |
Row 3 | 1003 | Midwest | Chicago | 403603.17 |
Row 4 | 1004 | South | Dallas | 324722.58 |
The first parameter can take a column variable.
ATL in Script | Result |
---|---|
| 345,052.14 |
| $345,052.14 |
| $345.1K |
Note
In a "Describe Row in Context" project, you would use SalesColumn
for the column variable.