Bug 55024 - [PATCH] MIRR Formula implementation
Summary: [PATCH] MIRR Formula implementation
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-29 08:31 UTC by Carlos Delgado
Modified: 2013-11-04 22:53 UTC (History)
0 users



Attachments
Patch with source code implementation for IRR function and test case (10.07 KB, text/plain)
2013-05-29 08:31 UTC, Carlos Delgado
Details
Test Spreadsheet for test case, must be added in test-data\spreadsheet (26.50 KB, application/vnd.ms-excel)
2013-05-29 08:32 UTC, Carlos Delgado
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Delgado 2013-05-29 08:31:01 UTC
Created attachment 30339 [details]
Patch with source code implementation for IRR function and test case

Implementation for MIRR (Modified internal rate of return) formula for Excel file, according to http://en.wikipedia.org/wiki/MIRR .

Includes test cases based on Irr function and Excel file to test implementation.
Comment 1 Carlos Delgado 2013-05-29 08:32:21 UTC
Created attachment 30340 [details]
Test Spreadsheet for test case, must be added in test-data\spreadsheet
Comment 2 Cédric Walter 2013-11-04 22:53:53 UTC
I did a review, and your code is not having any error handling. I did add it according to the specifications (http://office.microsoft.com/en-001/excel-help/mirr-HP005209180.aspx):

* Values must contain at least one positive value and
 one negative value to calculate the modified internal rate of return.
 Otherwise, MIRR returns the #DIV/0! error value.

By the way the above specification is wrong, in an Excel sheet, i discover:

when all values are positive, excel return a #DIV/0! -> expected as stated above
when all values are negative, excel return -1 (or -100%) -> not expected but this behavior is implemented now and covered by tests

I also added MIRR formulas to FormulaEvalTest.xls (were missing)

you can check my changes in revision 1538795