## Using The First Argument As Switch Flag

The first input argument to the ds function can play a special role as a switch flag that controls whether the function is executed or not.

Using the first argument in this way is preferable to using the Excel built-in formula

**, where**

*IF(b,ds(...),c)***runs if**

*ds(...)***is**

*b***, otherwise the constant**

*TRUE***is returned.**

*c*It works as follows:

*Case 1:*If it is a boolean equal to

**, the function runs processes the remaining arguments only and returns the calculated result.**

*TRUE*

*Case 2:*If it is a boolean equal to

**, the function ignores all remaining arguments and simply returns the old data that happen to exist in the function's output range.**

*FALSE*

*Case 3:*If it is a single value equalling either some text starting with the hash sign # or some number, the function ignores all remaining arguments and simply returns that single value.

More seldom used, the first argument may also contain the special text

**or**

**InputAsText****, that instructs Deriscope to initially parse all input data as if they were pure text, with the second case also resulting in the trimming of all leading and trailing white spaces of these data.**

**InputAsText_OuterTrimmed**Be careful to enter the special text exactly as it appears here, including the special prefix and suffix characters

***This seldom used functionality may be of interest when input data such a "2/6/23" or "0.03" need to be interpreted as text tokens rather than date and number respectively.

If the first argument is already used as a switch flag, then the second argument may carry the special text mentioned above.

Below is a list of 6 advantages associated with using the first argument as described above against using the Excel built-in formula

**.**

*IF(b,ds(...),c)*

*Advantage 1:*Turning the first argument to

**, the function still returns the previous output.**

*FALSE*This is very useful if the reason for using

**is to avoid recalculating a time consuming function all the time, but still want to keep the previously calculated output visible and accessible on the spreadsheet.**

*FALSE*One could achieve the same by using the circular Excel built-in formula

**, where**

*IF(b,ds(...),Address)***is the address of the cell containing the formula.**

*Address*The problem is that this formula is circular and leads to error, except if one changes Excel's global options to allow for iterative calculations.

The latter is nevertheless not advisable as it affects Excel's global behavior and may lead to undetected wrong output in formulas that involve unintended circular dependencies.

*Advantage 2:*When the cell containing the

**formula is selected, the user can use the Import/Export button as described in How To Export An Excel Formula**

*ds*

*Advantage 3:*Enhanced spreadsheet readability and maintenance since

**is a composite function consisting of the outer function**

*IF(b,ds(...),c)***conditionally calling the inner function**

*IF()***and therefore more complex than a single function**

*ds()*

*ds()*