average

Typefunction
DictionaryLCS
LibraryLiveCode Script
Syntax
average(<numbersList>)
Synonymsavg,arithmeticmean,mean
Summary

Returns the arithmetic mean of a list of numbers.

Introduced1.0
Changes

The ability to use an array was introduced in version 1.1. In previous versions, only lists of numbers could be used with the average function.

OSmac, windows, linux, ios, android
Platformsdesktop, server, mobile
Parameters
NameTypeDescription
numbersList

A comma-separated list of numbers, or an expression that evaluates to such a list, or an array containing only numbers.

Example
average(4,36,45,50,75) -- returns 42
put average(importedList) into field "Arithmetic Mean"
put average(replaceText(field "Values",return,comma)) into avgValue
Values
NameTypeDescription
return

The average function returns a number.

RelatedControl Structure: function
Glossary: return, value, math operation
Function: min, geometricMean, statRound, harmonicMean, variance, round, value, max, median, standardDeviation
Description

Use the average function to find the value that best represents a group of values.

The average of a list of numbers is the sum of the items in the list or elements in the array, divided by the number of items or elements.

The average function can also be written like this:

sum(numbersList)/the number of items in numbersList

If the numbersList is empty, the average function returns zero.

If a math operation on finite inputs produces a non-finite output, an execution error is thrown. See math operations for more information.

Tagsmath