sutoiku / formula.js

JavaScript implementation of most Microsoft Excel formula functions
Other
2.14k stars 293 forks source link

BETADIST function does not work correctly #40

Open ScottDWagner opened 9 years ago

ScottDWagner commented 9 years ago

This function does not appear to be working correctly In FormulaJS: BETADIST(1/52,0.4,9.6) FormulaJS = 9.966606842186747 Excel = 0.540601367

Could some one check this out for me.

0x333333 commented 9 years ago

According to MS Excel documentation: BETA.DIST function takes at least four parameters:

I'm not sure which version of Excel you are using, but in Online Excel and MS Excel for Mac v15.13 the function BETA.DIST accepts at least four parameters.

Here's my result in MS Excel:

BETA.DIST(1/52, 0.4, 9.6, TRUE) = 0.540601637
BETA.DIST(1/52, 0.4, 9.6, FALSE) = 9.966606952

In Formula.js if you only specified three parameters, Cumulative will be treated as false. Probably it could be better that Formula.js can throw an exception that when Cumulative is not specified, keep it the same way as MS Excel.

ScottDWagner commented 9 years ago

Ok I see in Excel 2013 the Last variable is not required. Basically it considers it true if you don’t put it in.

From: Zhipeng JIANG [mailto:notifications@github.com] Sent: Wednesday, October 28, 2015 5:30 PM To: sutoiku/formula.js formula.js@noreply.github.com Cc: ScottDWagner scott.wagner@falconskysoftware.com Subject: Re: [formula.js] BETADIST function does not work correctly (#40)

According to MS Excel documentation: BETA.DIST function https://support.office.com/en-my/article/BETA-DIST-function-11188c9c-780a-42c7-ba43-9ecb5a878d31?ui=en-US&rs=en-MY&ad=MY&fromAR=1 takes at least four parameters:

I'm not sure which version of Excel you are using, but in Online Excel and MS Excel for Mac v15.13 the function BETA.DIST accepts at least four parameters.

Here's my result in MS Excel:

BETA.DIST(1/52, 0.4, 9.6, TRUE) = 0.540601637 BETA.DIST(1/52, 0.4, 9.6, FALSE) = 9.966606952

In Formula.js if you only specify three parameters, Cumulative will be treated as false. Probably it could be better that Formula.js can throw an exception that when Cumulative is not specified, keep it the same way as MS Excel.

— Reply to this email directly or view it on GitHub https://github.com/sutoiku/formula.js/issues/40#issuecomment-152017059 . https://github.com/notifications/beacon/AJXx6LoGD0h42bfUA9T7B9q9T5o5Np3Jks5pAUPMgaJpZM4GXwsh.gif

ScottDWagner commented 9 years ago

I see it now in Excel 2013 the last variable is considered true if you do not input it. I will fix this on my app Thank you so much.

hershenov commented 7 years ago

Is this issue resolved?