Processing ranges of data

You can use custom functions to process arrays of data or ranges of cells. The example Total, in the directory Custom in the Examples archive, illustrates this use of custom functions. It returns the sum of the numbers contained in the first column of the range of cells. It can be used as the starting point for your own custom functions which process ranges of cells.

Cell A4 SET_NAME("sumtotal", D4) creates a name sumtotal and defines it to refer to the cell D4.

Cell A5 SET_VALUE("sumtotal", 0) sets the value of sumtotal (ie D4) to 0. Note the use of quotes in A4 and their absence in A5.

In cell A8, FOR("i", 1, rows(@list)), the part rows(@list) returns the number of rows in the array.

Cell A9 ...index(@list, 1, i) returns the ith element of the array to be added to the total.