# ListAvg

Gets the average of all values in a list

## Method Signature

```
ListAvg(list=[string], delimiter=[string], multiCharacterDelimiter=[boolean])
```

### Arguments

| Argument                  | Type      | Required | Description                                      | Default |
| ------------------------- | --------- | -------- | ------------------------------------------------ | ------- |
| `list`                    | `string`  | `true`   | The list to compact                              |         |
| `delimiter`               | `string`  | `false`  | string the list delimiter                        | `,`     |
| `multiCharacterDelimiter` | `boolean` | `false`  | boolean whether the delimiter is multi-character | `false` |

## Examples

### Calculate average from query columns

[Run Example](https://try.boxlang.io/?code=eJxlkE1Lw0AQhs%2FJrxjSgwksS1IU%2FMBDtBUqmoLtTTxskyFZyO7qfqSI%2BN%2BdpiLB3oZ35pmZ9xW%2B69Gjg1v4CGg%2FK9ynkMiGaaGQ7dD5rVSYMNK0xxYtG4StO2FZg7VUok8gu4lHtGyaF0O0%2BF3J4DWOvuIoWi3gGnJGVVU%2BL6lOSq1pJwl3y812uxrF4oKfx9E3mzDFlHk0nT5h5vzyHzOfMptwcuaKF0TEb4e391Z6XAf%2FHjyZLo9%2FnzkQA1rRIhzsgyf%2FIB3MqqB2aB%2BMVYLGe%2Bl8ObTpMbZ70welF8KLqf%2FkLz%2FIuDdPhKQZZNTIeZ6TOAOHtdGN42OMPw6cbts%3D)

```java
athletes = queryNew( "id,name,bestTime", "integer,varchar,decimal" );
queryAddRow( athletes, [
	{
		ID : 0,
		NAME : "Anne",
		BESTTIME : 15.4
	},
	{
		ID : 1,
		NAME : "John",
		BESTTIME : 12.8
	},
	{
		ID : 2,
		NAME : "Sue",
		BESTTIME : 9.1
	}
] );
writeOutput( "Athlete's average best time is #NumberFormat( listAvg( queryColumnData( athletes, "bestTime" ).toList() ), "0.00" )# seconds." );

```

Result: Athlete's average best time is 12.43 seconds.

### Additional Examples

[Run Example](https://try.boxlang.io/?code=eJwrL8osSXUpzS3QUPDJLC5xLEvXUFAy1DHSMVZS0FTQtFbQ11dwrShITS5JTVHILy0pKC2xUjDiAor6puYmpRYpuJXmJZdk5udx5QC1B5cUKdgqKJnomOqYKVlzlSMMB8kWlxTp5UAtAZnNhdVwUy4ANGItuQ%3D%3D)

```java
writeDump( ListAvg( "1,2,3" ) ); // Expected output: 2
// Member Function
listStr = "4,5,6";
writeDump( liststr.listAvg() );
 // Expected output: 5

```

## Related

* [GetToken](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/gettoken)
* [ListAppend](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listappend)
* [ListChangeDelims](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listchangedelims)
* [ListCompact](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listcompact)
* [ListContains](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listcontains)
* [ListContainsNoCase](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listcontainsnocase)
* [ListDeleteAt](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listdeleteat)
* [ListEach](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listeach)
* [ListEvery](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listevery)
* [ListFilter](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listfilter)
* [ListFind](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listfind)
* [ListFindNoCase](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listfindnocase)
* [ListFirst](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listfirst)
* [ListGetAt](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listgetat)
* [ListGetEndings](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listgetendings)
* [ListIndexExists](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listindexexists)
* [ListInsertAt](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listinsertat)
* [ListItemTrim](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listitemtrim)
* [ListLast](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listlast)
* [ListLen](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listlen)
* [ListMap](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listmap)
* [ListNone](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listnone)
* [ListPrepend](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listprepend)
* [ListQualify](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listqualify)
* [ListReduceRight](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listreduceright)
* [ListRemoveDuplicates](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listremoveduplicates)
* [ListRest](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listrest)
* [ListSetAt](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listsetat)
* [ListSome](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listsome)
* [ListSort](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listsort)
* [ListToArray](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listtoarray)
* [ListTrim](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listtrim)
* [ListValueCount](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listvaluecount)
* [ListValueCountNoCase](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/list/listvaluecountnocase)
