Setting Formula for Named Range

Setting Formula for Named Range

Like the Excel application, Aspose.Cells for Python via .NET APIs provides the ability to specify a formula for a named range by using its Range.refers_to property. There could be numerous use cases for this feature, a few of which are detailed as follows.

Setting a Simple Formula for Named Range

A simple formula could be a reference to another cell in the same (or different) worksheet. The following example creates a named range in a new spreadsheet and sets its reference to another cell.

Setting a Complex Formula for Named Range

A complex formula could be anything, such as a dynamic range or a formula spanning over multiple cells in different worksheets. The following example creates a dynamic range using the INDEX function to get the value from a list based on its location.

Here is another example that uses a named range to sum values from two cells in different worksheets.