Cell Referencing
================

Many commands and functions operate on a given cell or group of cells, and therefore take a cell or range reference (address) as an argument. An individual cell is specified by its row/column coordinates, which start with row 1, column 1 in the upper left of the spreadsheet.  A range is a rectangular group of cells, specified by giving its left and rightmost columns and top and bottom rows.

A reference may be absolute or relative.  An absolute reference is measured from the upper left of the spreadsheet, and does not change when the cell containing it is moved or copied.  A relative reference, however, is measured as an offset from the cell it is in, and when moved points to the cell at the same offset relative to the new location.

There are two ways of addressing cells in Oleo, called a0 and noa0.  To switch between the modes, use the set-option command:

M-x set-option a0
     Sets a0 mode.

M-x set-option no a0
     Sets noa0 mode.

In both modes the case of cell and range letters is ignored.

noa0 Mode
---------

In noa0 mode (the default), absolute cell addresses have the form RROWCCOL, where ROW and COL are the row and column (as integers).  Thus, R1C2 is the second cell from the left on the top row.       The cell in the leftmost uppermost corner is R1C1, and the cell in the rightmost lowermost corner is R65535C65535.

Relative addresses have the form R[ROWOFFSET]C[COLOFFSET], as in R[-1]C[+1] (the cell above and to the right of the current cell).  An offset of 0 can be omitted, along with its square brackets: RC[+2] (the cell two columns to the right).  The plus signs of positive offsets can also be omitted.  Absolute and relative addresses can be combined, as in R4C[-1] (the cell in row four that's one left of the current cell).

Ranges in noa0 mode are specified as RROW1:ROW2CCOL1:COL2, where the row and column references may be either absolute or relative, and can be mixed.  Thus, R1:4C1:[-2] refers to the cells of rows one through 4, columns one through the second column to the left.  If ROW1 = ROW2 or COL1 = COL2, the colon and second number may be omitted, as in R1:10C2 (rows one through ten in column two).

a0 Mode
-------

In a0 mode, relative references have the form COL_LET ROW_NUM, where COL_LET is the letter of the column and ROW-NUM is the row number.  COL_LET can be upper or lower case.  The cell in the leftmost uppermost corner is A1, and the cell in the rightmost lowermost corner is CRXO65535. The columns are initially single letters (A-Z) , then double letters (AA-ZZ), then triple letters (AAA-ZZZ), and finally some quadruple letters (AAAA-CRXO).

B3 refers to the cell in the second column of row 3. Since this is a relative reference, it will change when the containing cell is moved, to refer to the cell at the same relative position; e.g., if the cell is moved two columns to the right the reference will change to D3.

Absolute references have the form $COL_LET$ROW_NUM, as in $A$1 (top left cell).  These do not change when the containing cell is moved.  Both types can be mixed with predictable results, e.g., $A4 has an absolute column but a relative row.

Ranges are given as CELL_REF:CELL_REF or CELL_REF.CELL_REF, where the CELL_REFs describe diagonally opposite corners of the range.  Thus, A1:B2 refers to the topmost, leftmost four cells in the spreadsheet.

Comparison
----------

In order to get an understanding of these two addressing modes, assume that the cell cursor is in E7 = R7C5.  The left hand column is noa0 mode, and the right hand one is a0 mode.

                      R1C2              $B$1
                      R[-1]C[+1]        F6
                      RC[+2]            G7
                      R4C[-1]           $D4