Nothing of any real import to add to this discussion, but I do have a
question. Assuming that it is the -1 that is causing the problem and
accepting that it is possible to add one to the value, what happens if you
add minus one to the value? Something like this;

DATE(YEAR(B6), (MONTH(B6)+(-1)), DAY(B6))

That is assuming of course that Excel, and POI, can understand negative
numbers and I cannot see why they would not.

Yours

Mark B

PS Do not know if Excel will accept that bracketting; I have done it to make
the example more readable.


Bugzilla from [email protected] wrote:
> 
> https://issues.apache.org/bugzilla/show_bug.cgi?id=48528
> 
> --- Comment #6 from Jaibabu <[email protected]> 2010-01-21 00:08:41 UTC
> ---
> Hai Josh,
> 
>     Thanks for your response. I herewith attaching the Java file i used
> for
> writing Excel file using POI. (The java code reads a template excel file
> and
> generates the new Excel file with new values.)
> 
>     I am also attaching the "DemoTemplateFile.xlsx" which is used as a
> template
> file(from which the POI reads the format and formula) and
> "sampledemo.xlsx"
> file that POI generates using java code.
> 
>     In sampledemo.xlsx file please check the column "B12-B19" the Date
> formula
> is not evaluated correctly. But it evaluates the Date formula above that
> cell
> (B7-B11) correctly.
> The formula used in that column is DATE( YEAR(  B6  ), MONTH( B6  )-1,
> DAY( B6
> ) )
> Assuming -1 is the problem in evaluation.
> 
>     If suppose if i use +1 instead it is evaluating correctly. Please
> refer
> Column (A7-A19).
> 
>    I used formula Evaluator to evaluate the formula cells in the Sheet.
> But i
> get the same result.
> 
>   Hope this may be useful for you.
> 
> Thanks
> Jaibabu.J
> 
> -- 
> Configure bugmail:
> https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are the assignee for the bug.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/DO-NOT-REPLY--Bug-48528--New%3A-An-Error-in-Date%28%29-function-tp27122697p27303208.html
Sent from the POI - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to