Problems in Cells with IF statements

Hello,

I am using Aspose.Cells to populate a pre-built spreadsheet with data. This has been working for a while. I just received some changes to the spreadsheet that incorporates IF statements in one of the new cells. Based on data in some of the cells, certain values are supposed to display in the cells. The problem is when I open the spreadsheet the IF statements seemed to have no affect, but if I change one of the values to the same value it was and press enter, then the if statement will work. Is there a reason that the IF statement won’t pick up on the values on opening the spreadsheet? The formula being used is below. The value showing is ALWAYS Text4 even if the conditions have been met for any of the others.

=IF(OR(F88=“Text1”,F88=“Text2”),"",IF(AND(D78<=8,E87=“Yes”),“Text3”,“Text4”))

Thanks

Hi,

Please test your issue with latest Aspose.Cells for .NET 5.2.2.6 and let me know your findings.

The same results. If I manually update a cell to the same value it catches the IF statement, but upon open it’s as if the cells are empty in the eyes of the IF statement.

Hi,

I have tested the IF formula and it works fine in Aspose.Cells for .NET 5.2.2.6.

I created a file namely If.xlsx in which I used your formula, now if the B1 cell contains “Text1”, then A1 cell is empty as you can see in the source file if.xlsx.

And if B1 cell contains something else other than “Text1”, then A1 contains “Text3”.

B1:“Text1” >>>> A1:""
B1:“Test” >>>> A1:"Text3"


So, I loaded it with Aspose.Cells and change the changed the B1 cell value to “Test” and the output file if.xlsx.out.xlsx shows correct value inside the A1.

C#


string filePath = @“F:\Downloads<span class=“kwrd”>if.xlsx”;

Workbook workbook = new Workbook(filePath);


Cell b1 = workbook.Worksheets[0].Cells[“B1”];


b1.PutValue(“Test”);


workbook.Save(filePath + “.out.xlsx”);