There is a definition in `POISSON`

function that:

`#NUM!`

error – Occurs if either:

- The given value of x is less than zero;
- The given value of mean is

less than zero.

But I try to do this in Excel 2013. It gave me differnt value. Here is my example:

```
=POISSON(0,-0.5,FALSE)
```

the result is: `1.648721271`

instead of `#NUM!`

Any thoughts?

Speculatively, the bug might have come about as an optimization. `Poisson(x,m,TRUE)`

is defined as `e^(-m)*(m^x)/x!`

. One way to compute `m^x`

when `m`

is floating-point is as `e^(x*Ln(m))`

. In a spreadsheet, you can observe that

```
=POISSON(A1,A2,TRUE) - EXP(-A2)*EXP(A1*LN(A2))/FACT(A1)
```

always evaluates to exactly 0 whenever `A1,A2`

are in the correct domain (and not e.g. 0.0000000001 as might be the case if the calculation had used a different approach).

Furthermore, `EXP(-A2)*EXP(A1*LN(A2))/FACT(A1)`

fails when it should fail, giving `#NUM!`

when fed `0, -0.5`

. My speculation is that the Excel programmers initially used a formula which failed when it should have failed, letting the called functions raise the error when appropriate. Then someone had the bright idea of just returning `EXP(-mean)`

when `x = 0`

(since in that case the rest of the expression is 1 *when it is defined at all*). After all — why bother to compute something when you know that it is 1?

What I find astonishing is that the bug is still there with `POISSON.DIST`

Excel had been (and still is, although to a lesser extent) heavily criticized for the accuracy of its statistical functions and tests. So much so that “Friends don’t let friends use Excel for statistics” is a relatively well-known saying among statisticians. See this for a discussion. The dotted statistical functions such as `POISSON.DIST`

were explicitly designed to address the many complaints which had piled up. `POISSON`

itself is just kept around for backwards compatibility. It is strange how this bug slipped through what should have been a thorough rewriting of these functions from the ground up.

Tags: excelexcel, function, vba