Free Support Forum - aspose.com

Year, Month, and Day parameters describe an un-representable DateTime Exception on valid dates

Year, Month, and Day parameters describe an un-representable DateTime. Keep getting this exception when trying to calculate Excel YIELD function

Consider the following code

using (var wb = new Workbook())
        {
            var ws = wb.Worksheets[0];
            try
            {
                var str = "=YIELD(DATE(2017,3,31), DATE(2018,5,31),0.12,100,100,4)"
                var q = ws.CalculateFormula(str);
                return double.Parse(q.ToString()); 
            }

}

When plugging the formula directly onto Excel, this formula should return 11.99%

Anybody knows why this happens and how to work around it? Thanks.

@TCP,

Thanks for the sample code and details.

After an initial test, I am able to observe the issue as you mentioned by using your sample code. I found an exception “Year, Month, and Day parameters describe an un-representable DateTime.” occurred when calculating the valid formula ("=YIELD"). If I paste the formula into MS Excel directly, it works fine. I have logged a ticket with an id “CELLSNET-45485” for your issue. We will look into it figure it out soon.

Once we have an update on it, we will let you know here.

Thank you.

@Amjad_Sahi,

Thank you for the reply. And we are using Aspose.Cell for .NET version 17.6.0.0

@TCP,

Thanks for the information.

Please spare us little time and hopefully your issue would be sorted out soon.

Thank you.

@TCP

Please download and try the following fix and let us know your feedback.

The issues you have found earlier (filed as CELLSNET-45485) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi

The issues you have found earlier (filed as CELLSNET-45485) have been fixed in this update.