07.05.2014 Views

The Microsoft Excel File Format - OpenOffice.org

The Microsoft Excel File Format - OpenOffice.org

The Microsoft Excel File Format - OpenOffice.org

SHOW MORE
SHOW LESS

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.2 Token Classes<br />

3.2.1 Classified Tokens<br />

All function operators and most operand tokens exist in 3 different versions: as reference class token, value class token,<br />

and array class token. <strong>The</strong> token class depends on which type of data the involved operator expects. Sometimes only 1<br />

or 2 token classes are valid for a token (for example, array class tokens cannot exist as reference class tokens, but they<br />

can exist as value class tokens).<br />

• Reference class token: <strong>The</strong> reference address itself, independent of the cell contents.<br />

• Value class token: A value (a constant, a function result, or one specific value from a dereferenced cell range).<br />

• Array class token: An array of values (array of constant values, an array function result, or all values of a cell range).<br />

<strong>The</strong> structure of the 8-bit identifier of a classified token is described in the following table.<br />

Bit Mask Contents<br />

4-0 1F H Basic token identifier<br />

6-5 60 H 01 2 = Reference class token (token range 20 H -3F H )<br />

10 2 = Value class token (token range 40 H -5F H )<br />

11 2 = Array class token (token range 60 H -7F H )<br />

7 80 H 0 2 (zero)<br />

<strong>The</strong> token class is marked in the names of the tokens. <strong>The</strong> names of reference class tokens contain a trailing “R”, value<br />

class tokens contain a trailing “V”, and the names of array class tokens a trailing “A”.<br />

Example: <strong>The</strong> tArea token (➜3.9.3) is no specific token, but refers to the three tokens tAreaR (25 H ),<br />

tAreaV (45 H ), and tAreaA (65 H ).<br />

• <strong>The</strong> tAreaR token represents the cell range address itself.<br />

• <strong>The</strong> tAreaV token represents one value in the cell range (for example the value in the current row or column).<br />

• <strong>The</strong> tAreaA token represents the entire array of values in the cell range.<br />

3.2.2 Operand Classes<br />

Each operator and operand has a default token class, called operand class. For operands itself, the operand class is<br />

dependent on the data the token represents. <strong>The</strong> operand class of operators is determined from its return value. For<br />

functions (tokens tFunc, ➜3.7.1, and tFuncVar, ➜3.7.2), the operand class is dependent on the value the function<br />

returns. Classified tokens can represent their operand class, other tokens cannot.<br />

Examples for operand classes:<br />

Term Operand class Token identifier Description<br />

A1 Reference tRefR Reference to cell A1<br />

A1 A1 Reference tIsect Return value of the intersection operator<br />

INDEX(A1,1,1) Reference tFuncVarR Return value of the INDEX function<br />

2 Value tInt <strong>The</strong> constant 2<br />

2+3 Value tAdd Return value of the addition operator<br />

SUM(2,3) Value tFuncVarV Return value of the SUM function<br />

{2,3} Array tArrayA <strong>The</strong> constant array {2,3}<br />

TREND({2,3}) Array tFuncVarA Return value of the TREND function<br />

32

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!