We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

IF Statement in Formula?

Hi again,

Would it be possible to add IF support to the formulas? I have a couple of reports that need to use if statements.

Here is an example of somthing I am trying to do (that is not working with Aspose Excel):
=IF(H288 = “1”,“Commission”,IF(H288 = “2”,“Cheque”,""))

Thanks,
Alex.

Dear Alex,

Yes. I will add IF support to the formulas. It will be available at the beginning of next week.

Dear Alex,

Now it’s availabe. Please download it at http://www.aspose.com/products/aspose.excel/fixes/aspose.excel.zip.

Laurence,

Works well for the formula I posted but it seems a few operators do not work?? Could you check:

<> not equal to
> greater than
< less than
>= greater or equal
<= less or equal

Thank you very much for the quick response!
Alex.

Dear Alex,

Surely I will make these operators work. Please wait for another two days.

Thanks for your patience.

No hurry Laurence,

I have worked around it using just ‘=’ but it will be needed in the near future I am sure. These features are making Aspose.Excel a really powerful online reporting tool. Keep it up and thank you!

Alex.

Dear Alex,

Now it’s available. Please download Hotfix 1.7.6.

@alexidm.au,
We have discontinued Aspose.Excel and introduced an advanced version Aspose.Cells. It contains rich features including Formulas. You may try this product by downloading ready to run solution and check the latest features. Here is a sample code which demonstrates the usage of functions in this latest product:

// Instantiating a Workbook object
Workbook workbook = new Workbook();

// Adding a new worksheet to the Excel object
int sheetIndex = workbook.Worksheets.Add();

// Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[0];

// Adding a value to "A1" cell
worksheet.Cells["A1"].PutValue(1);

// Adding a value to "A2" cell
worksheet.Cells["A2"].PutValue(2);

// Adding a value to "A3" cell
worksheet.Cells["A3"].PutValue(3);

// Adding a SUM formula to "A4" cell
worksheet.Cells["A4"].Formula = "=SUM(A1:A3)";

// Calculating the results of formulas
workbook.CalculateFormula();

// Get the calculated value of the cell
string value = worksheet.Cells["A4"].Value.ToString();

// Saving the Excel file
workbook.Save(dataDir + "output.xls");

For more information on Formulas follow the link below:
Formulas

Download the latest version of Aspose.Cells for .NET from the following link:
Aspose.Cells for .NET (Latest Version)

You can download the latest demos here.