## Handling Excel Errors

Often Excel formulas return unexpected values that are either outright errors or deviate from what one would expect.

All such actual or perceived errors can be divided in the following three categories ordered from least severe to most severe:

*Diagnosed Error*

*Unknown Error*

*Wrong Result*The following screenshot shows a simple example for each error category using native Excel formulas.

The

**in cell D4 is the easiest type of error since it gives a hint for what caused the failure.**

*Diagnosed Error*In the shown example, Excel returns the visible text label

**, which tells in a not particularly verbose fashion that the failure is caused by an attempt to divide a number by 0.**

*#DIV/0!*Unfortunately, native Excel formulas only very seldomly return this type of diagnostic, perhaps because it is difficult to squeeze meaningful explanation in some short label for errors caused by more complex conditions.

The

**in cell I4 is quite dreadful as it gives no hint whatsoever for what went wrong.**

*Unknown Error*In the shown example, Excel returns the visible text label

**, which carries little to no information, even though the failure is clearly due to trying to divide a number by some text.**

*#VALUE!*Apparently, the Excel developers could not come up with some short text label like the

**that could be used to describe the case here.**

*#DIV/0!*Lastly, the

**in cell N4 is the absolute nightmare of every Excel user because the formula returns a seemingly valid value, which only after closer inspection is seen to be wrong.**

*Wrong Result*Unfortunately, the VLOOKUP formula in cell N4 not only fails to raise any alarms, but it also does not inform the user with regard to the steps it undertakes to calculate the displayed result of 3 million.

On a first glance, it is quite perplexing to understand why the population for London is calculated as 3 million, even though the table defines London's population as 9 million.

The only course of action in dealing with this error is to look up the documentation for the VLOOKUP function and try to understand it in depth with the hope of discovering what causes the wrong result.

The answer of course is that the VLOOKUP formula expects up to 4 arguments, but the last argument is the optional Range_lookup boolean that is set to

**by default if not explicitly supplied.**

*TRUE*But, Range_lookup being

**means that only an approximate match is applied, which works in a sensible way only if the city names at the left column are sorted.**

*TRUE*In this case, the city names are not sorted, with the erroneous output number of 3 million being the result.

*Let us now see how Deriscope handles these three types of errors.*The following screenshot shows a simple example for each error category using Deriscope formulas.

The

**in cell D4 is produced because the function attempts to calculate the logarithm of -1, a mathematically impossible task in the world of real numbers.**

*Diagnosed Error*The Deriscope formula returns the text

**, which is the handle name of an Deriscope Object, of which the contents can be seen inside the Wizard by selecting the cell D4 while the wizard is open.**

*&ERROR!_D4:1.1*In this case, the object is of Deriscope Type Error and therefore contains only some readable message that appears at the very bottom of the wizard explaining that it

**, as shown below:**

*cannot compute the logarithm of the negative number -1*The

**should never happen with Deriscope Excel formulas.**

*Unknown Error*Of course it is unavoidable in practice, but best efforts are taken that a meaningful diagnostic message is returned in all situations.

The more demanding case of the

**in cell N4 emerges because the formula is supposed to return the price as of 9-Mar-22 of a zero bond with notional = 100 and maturity = 9-Mar-23 using a yield curve built with a flat 1% rate.**

*Wrong Result*The time distance from 9-Mar-22 to 9-Mar-23 is one year => the discount factor implied by a flat 1% rate ought to be close to 0.9 and therefore the price of the zero bond should be close to 99.

Paradoxically, the function in cell N4 returns a much bigger number close to 99.99.

Fortunately the user has a chance to understand and correct this error because Deriscope exposes several details regarding the various objects that participate in this function's outcome.

In situations like this, it is highly recommended to inspect the actual contents of the involved objects using the wizard because they may sometimes contain data that deviate from one's expectations.

In the current case, one could decide to inspect the contents of the Yield Curve object in cell N9.

Selecting the cell N9, the following appears in the wizard:

To the trained eye, the highlighted value

**strikes as unnaturally small, given the input rate of 1%.**

*Flat Rate= 0.0001*This observation tells the user to revisit the spreadsheet input for the flat rate, where one may now realize that the entry of 1% in cell N14 should be changed to 1 because the key in cell M14 ends with (%), which means the numbers are interpreted as percentages.

As a last resort, the user may want to use the Deriscope's Pricing Steps Tracing feature.

By perusing the trace data, the cause of the wrong result may become evident

*Last course of action.*If all rescue attempts have been proven futile, it is a good idea to seek advice from a colleague or from this software's vendor.

The latter can be most easily accomplished through the Excel Live Chat facility.

The offending formula can be also sent to Deriscope support using the How To Export An Excel Formula method.