SUM

The syntax for SUM is SUM( data ).

SUM returns the sum of all non-blank values in a range of data. SUM calculates based on how the data parameter is defined.

  A B
1 3 1
2 4 2
3 5 7
4 6 8

 

This list of common cases uses the table above:

  • If the data parameter is defined with a vector, SUM (A:A), the sum of the column is returned: 18.
  • If the data parameter is defined with two vectors, SUM (A:A, B:B), the sum of each pair of corresponding values (A1+B1, A2+B2...) is returned in a list: 4, 6, 12, 14
  • If the data parameter is defined with a vector and scalar, SUM (A:A, 7), the sum of each value and the scalar (A1+7, A2+7...) is returned in a list: 10, 11, 12, 13.

SUM example

  A B
1 Date Revenue
2 Jan 450
3 Feb 231
4 Mar 942
5 Apr 853
6 May 753
7 Jun 234
8 Jul 532
9 Aug 323
10 Sep 654

 

In this example, data is set to the Revenue data in column B (B:B). SLICE is used to remove the column header.

SUM( SLICE(data) )

Result: 4,972

Related links: