apoc.coll.sum

Details

Syntax

apoc.coll.sum(coll)

Description

Returns the sum of all the INTEGER | FLOAT in the LIST<INTEGER | FLOAT>.

Arguments

Name

Type

Description

coll

LIST<INTEGER | FLOAT>

The list of numbers to create a sum from.

Returns

FLOAT

Usage examples

The following examples compute the sum of values in a list using both APOC and Cypher:

apoc.coll.sum
WITH [1,2,3,4,5] AS list
RETURN apoc.coll.sum(list) AS output
Using Cypher’s reduce()
WITH [1,2,3,4,5] AS list
RETURN reduce(sum = 0.0, x IN list | sum + x) AS output
Results
Output

15.0