title: Using Excel PERCENTILE function in Apache POI
body: <p>I am using Apache POI 3.9 and I need to use the Excel formula PERCENTILE and evaluate the formula from within Java.</p>
  
  <p>The problem is that PERCENTILE is not supported.</p>
  
  <p>I get a <code>org.apache.poi.ss.formula.eval.NotImplementedException:</code> error</p>
  
  <p>I have 3 possible solutions to my problem.</p>
  
  <ol>
  <li><p>Write my own percentile function in java and contribute it to the Apache POI library (See <a href="http://poi.apache.org/spreadsheet/eval-devguide.html" rel="nofollow noreferrer">http://poi.apache.org/spreadsheet/eval-devguide.html</a>)</p></li>
  <li><p>Take the relevant cells from the Excel sheet into java and calculate them using a function such as the one in <a href="https://stackoverflow.com/questions/8137391/percentile-calculation">Percentile calculation</a></p></li>
  <li><p>Convert the PERCENTILE into a SMALL function
  such as instead of <code>=PERCENTILE(A1:A10,95%)</code>
  then <code>=(SMALL(A1:A10,9)+SMALL(A1:A10,10))/2</code></p></li>
  </ol>
  
  <p>At this point in time I need a speedy solution. For me, the third would be the best, but it doesn't give exactly the same results.</p>
  
  <p>Does anyone have any ideas before I fallback on option 2 which is a bit messy?</p>