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 />

• Step 2: Forced Array Class<br />

If the token is part of a function parameter (directly or indirectly, for example nested in another function), transformation<br />

of the token class is dependent on the expected token classes of all involved functions. For this purpose, a Boolean state<br />

“forced array class” is carried, and it will be updated whenever processing of a new function parameter is started. If this<br />

state is set to true already, nothing will be changed (the state is still true). If the state is false, it will be changed to true,<br />

if one of the following conditions is met:<br />

• In cell type formulas: if the parameter expects array class, or<br />

• In array type formulas: if the parameter expects reference class or array class, or<br />

• In name type formulas: if the parameter expects reference class or array class, or if the function returns a value with<br />

value class or array class.<br />

<strong>The</strong> forced array class state will be restored, when the entire function parameter is processed. <strong>The</strong> state starts with false<br />

at root level of all formula types.<br />

As described below, the cell formula =ABS(A1) changes its tRefR token to value class (tRefV). <strong>The</strong> formula<br />

=MDETERM(ABS(A1)) behaves differently: <strong>The</strong> first parameter of the MDETERM function expects array<br />

class. <strong>The</strong>refore the “forced array class” state is set to true, when the parameter (the term SUM(A1)) is started.<br />

This state is the reason that the tRefR token will be changed to array class (tRefA), regardless that the ABS<br />

function does not indicate this. When the parameter is completed, the forced array class state is restored to its<br />

old value (false).<br />

• Step 3: Token Class Transformation<br />

Token class transformation is dependent on the expected token class of the current position in the formula.<br />

• Current position is a function parameter expecting a reference class token (for example the parameters of the SUM<br />

function), or it is the root level of a name type formula (for example the return value of the outer function in a defined<br />

name):<br />

▪ Reference class tokens are not modified.<br />

▪ Value class tokens will be changed dependent on further conditions. In array type functions and name type<br />

functions, or if the forced array class state is set, it is changed to array class. In all other cases (cell type formula<br />

without forced array class), value class is retained.<br />

▪ Array class tokens are not modified.<br />

Examples for reference class tokens, when reference class is expected:<br />

• In the formula =SUM(A1), the tRefR token is not modified (function parameter expects reference class).<br />

• In the defined name =Sheet1!A1, the tRef3dR token is not modified (root level of a name type formula).<br />

Examples for value class tokens, when reference class is expected:<br />

• In the cell formula =SUM(PI()), the tFuncV(PI) token is not modified (cell formula, no forced array class).<br />

• In the array formula {=SUM(PI())}, the tFuncV(PI) token is set to array class (array type formula).<br />

• In the cell formula =MDETERM(SUM(PI())), the tFuncV(PI) token is set to array class (forced array<br />

class in MDETERM function parameter).<br />

Examples for array class tokens, when reference class is expected:<br />

• In the formula =SUM({1}), the tArrayA token is not modified.<br />

• In the defined name ={1}, the tArrayA token is not modified (root level of a name type formula).<br />

34

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

Saved successfully!

Ooh no, something went wrong!