Bug 55724 - [PATCH] Implementation of Excel PERCENTILE function
Summary: [PATCH] Implementation of Excel PERCENTILE function
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 3.9-FINAL
Hardware: PC All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2013-10-30 11:51 UTC by tenielg
Modified: 2013-11-06 17:12 UTC (History)
0 users

patch (2.70 KB, text/plain)
2013-10-30 11:51 UTC, tenielg
Testcase for Percentile (4.93 KB, patch)
2013-11-06 16:33 UTC, tenielg
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description tenielg 2013-10-30 11:51:52 UTC
Created attachment 30985 [details]

Attached is an implementation of Excel PERCENTILE function.

This is my first ever submission to the Apache POI project, so please advise me if I have done anything wrong.
Comment 1 Nick Burch 2013-10-30 12:09:12 UTC
Thanks for this!

Any chance you could work up a unit test for the function? That will let us check that it's working right now, and also ensure it doesn't get broken in future

Also, if possible, and update to the overall formula evaluation checking tests in FormulaEvalTestData would be great. Bug #54469 has quite a bit on that in it, if you want to see how people have helped with that in the past
Comment 2 tenielg 2013-10-30 16:11:37 UTC
When you say unit test do you mean to write \testcases\org\apache\poi\ss\formula\functions\TestPercentile.java?

And do you mean to update the Excel FormulaEvalTestData.xls? Where is the latest version I can download?
Comment 3 Cédric Walter 2013-11-05 22:13:51 UTC
Thanks for your contribution! I did: 

1. Just add a missing error handling in percentile:
if array is empty or contains more than 8,191 data points, PERCENTILE returns the #NUM! error value.

2. Added tests in overall formula evaluation checking in FormulaEvalTestData.xls. I found no differences between your code and excel evaluation of PERCENTILE.

But please provide a unit test TestPercentile.java so i can close the issue 

revision 1539154
Comment 4 tenielg 2013-11-06 16:33:31 UTC
Created attachment 31017 [details]
Testcase for Percentile
Comment 5 tenielg 2013-11-06 16:49:04 UTC
Thank you Cédric for your fixing and comments on my code.  (I did not think of looking up the official Excel documentation - thank you, and I know for next time.) Please see test case as requested.
Comment 6 Cédric Walter 2013-11-06 17:12:42 UTC
Thanks you, your unit has been merged in revision 1539401 to trunk