The Microsoft Excel File Format - OpenOffice.org
The Microsoft Excel File Format - OpenOffice.org
The Microsoft Excel File Format - OpenOffice.org
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
3.2 Token Classes<br />
3.2.3 Expected Parameter Classes<br />
Function parameters expect operands of specific operand classes. <strong>The</strong> expected token classes of all function parameters<br />
are specified in the list of built-in functions (➜3.11). <strong>The</strong> result of the whole formula is handled as a parameter, called<br />
the root level parameter (the parameter of the equality sign). <strong>The</strong> root level also expects a specific token class.<br />
Examples for function parameter classes:<br />
• Reference class:<br />
ROW(A1) (the first parameter of the function ROW expects reference class, ROW(1) would produce an error).<br />
• Value class:<br />
ABS(A1) (the first parameter of the function ABS expects value class, it dereferences the cell reference to a<br />
value).<br />
• Array class:<br />
MDETERM(A1:C3) (the first parameter of the function MDETERM expects array class, it dereferences the<br />
cell range to an array of values).<br />
• Root level:<br />
=A1 (parameter is on formula root level, expected class is dependent on formula type).<br />
3.2.4 Token Class Transformation<br />
<strong>The</strong> final class of a token depends on the combination of the operand class of the token and the expected parameter<br />
class. Furthermore it is dependent on the type of the formula. <strong>The</strong>re are 3 different types of formulas:<br />
Formula type<br />
Cell type formula<br />
Array type formula<br />
Name type formula<br />
Examples<br />
Cell formulas (➜4.7), shared formulas (➜4.8)<br />
Array formulas (➜4.8), conditional formatting (➜4.12), data validity (➜4.14)<br />
Defined names (➜4.10), reference lists (for example chart source range, form control links)<br />
Token class transformation is done in several steps. All steps have to be performed for each classified token in a formula.<br />
• Step 1: Value Operators<br />
If the token has reference operand class, and if it is a direct operand of a unary or binary value operator (tAdd, tSub,<br />
tMul, tDiv, tPower, tConcat, tLT, tLE, tEQ, tGE, tGT, tNE, tUplus, tUminus, or tPercent – the binary reference<br />
operators tRange, tList, and tIsect are not included here), its class will be changed to value class, and further handling is<br />
done regarding this new class (for example it may be changed to array class later).<br />
Example: In the formula =SUM(A1,B1+1), the cell addresses A1 and B1 are represented by tRefR tokens.<br />
Because the second tRefR token containing B1 has reference operand class, and it is an operand of the addition<br />
operator, it will be changed to value class (tRefV). As described below, in array type formulas this token will be<br />
changed to array class then, while the reference class of the first tRefR(A1) token is retained.<br />
33