Sunday, November 7, 2021

Use names in formulas

You can create formulas that are easy to understand by using descriptive names to represent cells, ranges of cells, formulas, or constant values.

Use the provided sample data and the following procedures to learn how to assign names to cell references and create formulas that use them.

Copy the sample data

To better understand the steps, copy the following sample data to cell A1 on a blank sheet.

  1. Create a blank workbook or sheet.

  2. Select the following sample data.

    Note: Do not select the row or column headings (1, 2, 3...  A, B, C...) when you copy the sample data to a blank sheet.

    Selecting sample data in Help

    Select sample data

    Region

    Projected

    Actual

    East

    $5,000

    $5,325

    West

    $1,500

    $1,477

    South

    $2,500

    $2,633

    North

    $500

    $1,211

    Midwest

    $3,500

    $3,322

    Central

    $2,000

    $2,120

  3. Press COMMAND+ C .

  4. In the sheet, select cell A1, and then press COMMAND+ V .

Create a formula by assigning a name to cells

  1. Select cells C2 through C5, which are the actual sales for the East, West, South, and North regions.

  2. On the left of the formula bar, in the Name box, type MyRegions and then press RETURN .

    The name "MyRegions" is assigned to the cells C2 through C5.

  3. Select cell C9, and then type Average sales for my regions.

  4. Select cell C10, type =AVERAGE(MyRegions), and then press RETURN .

    The result is 2661.5.

  5. Select the cell that contains 2661.5.

  6. On the Home tab, in the Number group, click the Number Format menu Format Number box, and then click Currency.

    The result is $2,661.50, which is the average actual sales for the East, West, South, and North regions.

    Tips: 

    • To review and manage the names that you have assigned, on the Insert menu, point to Name, and then click Define.

    • You can create a list of all the names that are assigned to cells in a workbook. Locate an area with two empty columns on the sheet (the list will contain two columns — one for the name and one for the cells referenced by the name). Select the cell that will be the upper-left corner of the list. On the Insert menu, point to Name, and then click Paste. In the Paste Name dialog box, click Paste List.

  1. Select cells C2 through C5, which are the actual sales for the East, West, South, and North regions.

  2. On the left of the formula bar, in the Name box, type MyRegions and then press RETURN .

    The name "MyRegions" is assigned to the cells C2 through C5.

  3. Select cell C9, and then type Average sales for my regions.

  4. Select cell C10, type =AVERAGE(MyRegions), and then press RETURN .

    The result is 2661.5.

  5. Select the cell that contains 2661.5.

  6. On the Home tab, under Number, click Currency  Currency button.

    The result is $2,661.50, which is the average actual sales for the East, West, South, and North regions.

    Tips: 

    • To review and manage the names that you have assigned, on the Insert menu, point to Name, and then click Define.

    • You can create a list of all the names that are assigned to cells in a workbook. Locate an area with two empty columns on the sheet (the list will contain two columns — one for the name and one for the cells referenced by the name). Select the cell that will be the upper-left corner of the list. On the Insert menu, point to Name, and then click Paste. In the Paste Name dialog box, click Paste List.

Guidelines for creating names

Guideline

Description

Allowed characters

The first character of a name must be a letter or an underscore character (_). Remaining characters in the name can be letters, numbers, periods, and underscore characters. In some languages, Excel may replace certain characters with underscores.

Syntax

Spaces are not allowed. Underscore characters and periods can be used as word separators — for example, Sales_Tax or First.Quarter.

Cell reference conflicts

Names cannot be the same as a cell reference, such as Z$100, BIN9, or R1C1.

Maximum number of characters

A name can contain up to 255 characters. If a name that is defined for a range contains more than 253 characters, you cannot select it from the Name box, but you can still use it in formulas.

Case sensitivity

Names can contain uppercase and lowercase letters, but Excel does not differentiate between them. For example, if you have named one cell "Sales" and then name another cell "SALES" in the same workbook, the second name will replace the first name.

See also

Calculation operators and order of operations

No comments:

Post a Comment