View on GitHub

dotnet-eud

.NET Controls End-User Documentation

Defined Names

The Spreadsheet allows you to define a descriptive name for an individual cell, cell range, function, or constant value to make it easier to understand the information contained in worksheet formulas.

Defined Name Overview

A defined name is a meaningful shorthand name that describes the meaning of an individual cell, cell range, function, or constant value. Each defined name contains the following information.

Defined Name Scope

Each defined name has a scope - an area (individual worksheet or entire workbook) where the name is recognized and can be used without qualification. For example, a defined name (cellName) whose scope is the first worksheet of a workbook (Sheet1) is recognized without qualification in this worksheet only (e.g., =5+cellName). To use this defined name in other worksheets, precede it with the name of the worksheet to which the defined name belongs (e.g., “=5+Sheet1!cellName”). If the scope of a defined name (cellName_global) is an entire workbook, this name is recognized in any worksheet of this workbook (e.g., “=5+cellName_global”).

[!NOTE] Each name must be unique in its scope.

If the defined name is not found, the cell that uses this name displays the #NAME? error.

Syntax Rules for Names

When you create or modify a defined name, follow these rules.

Create a Name Using the Name Box

  1. Select a cell or a range of cells for which you wish to define a name.
  2. Type the name you want to use to refer to the selection in the Name Box located to the left of the Formula Bar. Press ENTER.

    SpreadsheetControl_NameBox_CreateName

    Now you can quickly select the defined cell range by its name. To do this, click the drop-down arrow to the right side of the Name Box, and select the required name from the drop-down list.

    SpreadsheetControl_NameBox_NavigateToNamedCells

Create a Name Using the New Name Dialog

The New Name dialog gives you more flexibility for naming parts of your document. Using this dialog, you can name cell ranges, formulas and constants, and provide additional information for created names.

  1. To invoke the New Name dialog, on the Formulas tab in the Defined Names group, click the Define Name button.

    Spreadsheet_DefineNameCommand

  2. In the invoked dialog in the Name box, type a name to be associated with a cell or cell range, formula or constant.

    Spreadsheet_NewNameDialog

  3. In the Scope drop-down list, select the scope of the defined name: specify whether a name should be accessible within an entire workbook or an individual worksheet only.
  4. In the Comment box, enter a descriptive text for your defined name (optionally).
  5. In the Refers to box, type a cell reference, formula or constant for which you wish to define a name.

    By default, when you invoke the New Name dialog, the current selection is displayed in the Refers to box. However, you can enter another cell range by selecting it directly in the worksheet. To do this, click the Collapse Dialog button (SpreadsheetControl_NameManager_CollapseDialogButton) to minimize the dialog and access the worksheet, select the appropriate cell range, and then click the Expand Dialog button (SpreadsheetControl_NameManager_ExpandDialogButton) to restore the dialog’s initial state.

    SpreadsheetControl_NewNameDialog_Expand

  6. Click OK to finish creating the name.

Create Names from Selection

The Create Names from Selection dialog allows you to automatically generate names for rows and columns in the selected range using the row and column labels.

To create a name from a selection, do the following.

  1. Select a cell range to be named, including the row or column labels to be used for generating names.
  2. On the Formulas tab in the Defined Names group, click the Create from Selection button, or press CTRL+SHIFT+F3.

    Spreadsheet_CreateFromSelectionCommand

  3. In the invoked Create Names from Selection dialog, specify which row (top or bottom) or column (left or right) contains labels that should be used for generating names, and click OK.

    Spreadsheet_CreateFromSelectionDialog

[!NOTE] Names generated using this approach do not include the row and column labels and refer only to the cells containing values.

Mange Names Using the Name Manager Dialog

The Name Manager dialog lists all the defined names specified in a workbook and allows you to create new names, edit and delete existing names.

SpreadsheetControl_NameManager

To invoke the Name Manager dialog, on the Formulas tab in the Defined Names group, click the Name Manager button.

Spreadsheet_NameManagerCommand

Use Names in Formulas

To insert an existing defined name into a formula, type the required name directly in the formula or select it from the Use in Formula list on the Formulas tab in the Defined Names group.

Spreadsheet_UseInFormulaList

Delete Names

To remove a defined name, do the following.

  1. On the Formulas tab, in the Defined Names group, click the Name Manager button.

    Spreadsheet_NameManagerCommand

  2. In the invoked Name Manager dialog, select the name you wish to delete.
  3. Click the Delete button, or press DELETE.

    Spreadsheet_NameManager_DeleteName