As part of the Formula.js project, I am trying to remake Excel ACCRINT (in JavaScript, but the language should not matter). I tried to find the correct description of how it should work (especially with respect to the first_interest parameter), but did not find anything.
Interestingly, Excel, Google Spreadsheets, Apple Numbers, Gnumeric, and OpenOffice disagree on how to implement it, although all three major versions of Excel (Win, Mac, Web) seem to be consistent with each other. You can find several more contexts on this blog .
Dozens of tests and my current (fixed) implementation can be found here .
Any help would be greatly appreciated!
UPDATE: to be clear, the problem is not related to the daily billing counter , which we implemented using the David Wheeler pseudo-code for YEARFRAC , which itself was confirmed by more than 32 million tests covering all five basic variants. The problem comes from the first_interest parameter, which no one seems to understand. As far as we can tell, this parameter is simply ignored by many alternative spreadsheets, including OpenOffice (it is commented out in the source code). And this parameter really behaves in a strange way. If you use Excel and you change its value, you will see that it will change the results obtained by the ACCRINT function, but as if they are chaotic. Try changing the first_interest date to a full century, and you will see that the accrued interest changes, but not much. I really can't understand. If anyone can, I'm all ears ...
Ismael ghalimi
source share