Apply Formula to a Range


I want to set the same formula (in relative way) for a range.

A1 = 2 | B1 = 4 | C1 = A1 + B1
A2 = 3 | B2 = 3 | C2 = A2 + B2
A3 = 5 | B3 = 9 | C3 = A3 + B3

Do I need set the formula in code for C1, C2, C3, … for each cell (iterate to all cells and do cell.Formula = “myformula”) or is it possible to set somehow the formula for a range/area?

Thanks for your help

Hi Giuseppe,

I think you may use Cell.SetSharedFormula() method for your need. See the document for your reference:

Thank you.

Ecactly what I was looking for.

Thanks for your support.
It’s extreme fun develop with aspose cells!