SpreadJS Documentation
SUM
SpreadJS Documentation > Formula Reference > Formula Functions > SUM

This function returns the sum of cells or range of cells.

Syntax

SUM(value1,value2,...)

SUM(array)

SUM(array1,array2,...)

Arguments

Each argument can be a double-precision floating-point value, an integer value, or an array (cell range) of these. Up to 255 arguments may be included. You can use a single array (cell range) instead of a list of values. You can use multiple arrays (cell ranges) as well.

Remarks

Range references with mixed relativeness for column or row end points are not supported with the SUM function. R1C[1]:R2C[2] is okay but, R1C1:R2C[2] is not.

The SUM function ignores non-numeric values passed by reference. For example, if A1 contains TRUE, A2 contains "2", and A3 contains 4, then:

TRUE+"2"+4 evaluates to 7

A1+A2+A3 evaluates to 7

SUM(TRUE,"2",4) evaluates to 7

SUM(A1,A2,A3) evaluates to 4

The + operator provides an auto-conversion for non-numeric values passed by constant and for non-numeric values passed by reference. The SUM function provides an auto-conversion for non-numeric values passed by constant but, ignores non-numeric values passed by reference.

Data Types

Accepts numeric data for all arguments. Returns numeric data.

Examples

SUM(A1,B7,C11)

SUM(A1:A9)

SUM(A2:A14,B2:B18,D12:D30)

SUM(R1C2,R3C5,R6C2,R1C7)

SUM(95,89,73,87,85,76,100,96,96) gives the result 797

See Also