sumIf

Function: sumIf()

Returns the sum of a set of numbers on the condition that all the values are either null or valid Numbers, a type error will be thrown if any of the values are non-numeric.

Syntax

sumIf(list)

ArgumentTypeDescription
listNumber ArrayAn Array containing a list of numeric values

Examples

sumIf([10, 2, 3, 3.3])

Returns the sum of the numbers in list above i.e. 10 + 2 + 3 + 3.3 = 18.3

sumIf([10, 2, , 3.3])

Returns the sum of the numbers in list above and will ignore empty values i.e. 10 + 2 + 3.3 = 15.3

sumIf([10, 2, a, 3.3])

Returns a type error as the value 'a' is not a numeric value

sumIf(in.invoiceAmount)

Returns the sum of all invoiceAmount that are returned by pipe in. E.g. if this expression were on an Aggregating Stream the sum would be over all invoices which matched the Pipe Grouping criteria.

See Also