Hi,
I am trying to  correct a bug in the XIRR function (it is rather improve than correct). The idea behind the correction is the following:

1- try to find a solution (XIRR) using the guess value given by the user or  using the default value
2-if the try with those values does not lead to a solution so begin to scan for a guess value from -0.99 to +0.99 with 0.01 step until one get a Guess Value which leads to  Solution.

first to experiments I have written a code but It seems that I have a problem with the outer while loop. Can someone give me a hint where is the problem?

regards
Driss