RANK formula support

hi laurence,

i need to support the RANK formula in a range for a template. i believe the RANK formula is not currently supported in the Cell.Formula property.

the Cell.SetArrayFormula() method looks interesting, but i could not find sufficient information on this.

as was suggested in another thread, is it possible to have a property (e.g., NativeExcelFormula) that can be calculated by Excel when the workbook is opened in Excel? this will be useful but may break your design principle of not requiring Excel.

appreciate your thoughts as to how to achieve this.

thanks,
nick

i just saw the documentation for SetArrayFormula() at:
Manage formulas of Excel files|Documentation

but unfortunately, it will not help in my case, i think.

nick

Hi Nick,

I added RANK function in this attached fix. Please use Cell.Formula to assign it.

Hi Laurence,

The fix works great! Thanks for the support.
Nick

I’m sorry to kick such an old topic, but it seems like I’m having the same problem with the Rank-function in Aspose.Cells 4.4.0.5.

Will the Rank-function be available in future releases ?

Hi,

Thanks for considering Aspose.

Well, Rank function is supported. I tested it works fine. Following is my testing code:

Workbook workbook =new Workbook();
workbook.Open("d:\\test\\rankbook.xls");
Worksheet worksheet = workbook.Worksheets[0];
Cells cells = worksheet.Cells;
cells["A8"].Formula = "=RANK(A2,A1:A6,1)";
workbook.CalculateFormula();
MessageBox.Show(cells["A8"].StringValue);
Could you try the attached version. If you still find the problem, post your template file and paste your sample code here. We will check it soon.
Thank you.

Hi,

Thanks for the very quick response!

I never used formulas in Aspose before, so I was not paying a lot of attention to the manner of writing them. I’ve tested .Formula = “=Sum(A2:A5)” and this worked like a charm… but the Rank didnt

But when I look at your code I noticed the difference between mine :wink:

cells[“A8”].Formula = “=RANK(A2,A1:A6,1)”;
vs
cells[“A8”].Formula = “=RANK(A2;A1:A6;1)”; (I did a copy paste from my excelsheet)

thanks again,
bart,