Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Use Names in Formulas

This example demonstrates how to use a named cell range in a formula. In some cases, it can be useful to name individual cells and cell ranges to make it easier to understand what information they contain.

View Example

// Access the "A2:C5" range of cells in the worksheet.
CellRange range = worksheet.Range["A2:C5"];

// Specify the name for the created range.
range.Name = "myRange";

// Create a formula that sums up the values of all cells included in the specified named range.
worksheet.Cells["F3"].Formula = "= SUM(myRange)";

The image below shows a named cell range, and the result returned by the formula using this range (the workbook is opened in Microsoft® Excel®).

Spreadsheet_Formula_NamedRange

See Also