The Microsoft Excel File Format - OpenOffice.org
The Microsoft Excel File Format - OpenOffice.org
The Microsoft Excel File Format - OpenOffice.org
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
3 Formulas<br />
3.3 Cell Addresses in Tokens<br />
All tokens containing cell addresses (with the two components row and column) store them in the same format. <strong>The</strong>re are<br />
differences in storing relative components of an address.<br />
3.3.1 Absolute and Relative Components of a Cell Address<br />
An absolute component of an address (for example the row in B$6) points always to the same fixed row or column. It is<br />
stored with its zero-based index (the value 0 refers to row 1 or column A).<br />
To store a relative component (for example the column in B$6), there are two different ways used in an <strong>Excel</strong> file:<br />
• In method [A], the reference component is stored equally to absolute components (with its zero-based index), together<br />
with the information, that the component is relative.<br />
• In method [B], a signed offset is stored for the reference component. <strong>The</strong> resulting address can be calculated later from<br />
the position in the current context (for example the cell position in which a defined name is used).<br />
<strong>The</strong> following table shows which formula type in <strong>Excel</strong> uses which method to store relative components:<br />
Method<br />
[A]<br />
[B]<br />
Formula type<br />
Cell formulas (➜4.7), array formulas (➜4.8)<br />
Shared formulas (➜4.8), conditional formatting (➜4.12), data validity (➜4.14), defined names (➜4.10)<br />
Example for method [A]: <strong>The</strong> reference in the cell formula =C4 is stored in a tRef token (➜3.9.2). Regardless of<br />
the position of the formula, the token always contains the row index 3 (zero-based index for row 4) and the<br />
column index 2 (zero-based column index for column C), together with two flags, that row and column indexes<br />
are relative. <strong>The</strong>se flags are used for example when the cell is copied to another position (to adjust the relative<br />
reference components), but they do not influence the evaluation of the formula.<br />
Example for method [B]: <strong>The</strong> reference in the condition =C4 in a conditional formatting, entered in cell A7, is<br />
stored in a tRefN token (➜3.9.10). <strong>The</strong> token does not contain the address C4 itself, but the difference to the<br />
base cell A7, therefore it contains the row offset –3 (three rows up) and the column offset +2 (2 columns to the<br />
right). If the same conditional formatting is copied, the token will not be modified, because it only contains<br />
offset values, and not an explicit cell address. If it is copied for example to cell B8, the condition will refer to<br />
cell D5 (three rows up and 2 columns to the right from cell B8).<br />
36