Excel refer to cell in named range

T

Texas Longhorn

Active Member

JoinedSep 30, 2003Messages493

  • Nov 10, 2003
  • #1

I have five tabs in a workbook, Assumptions, East, West, North, and South. In cell A2 of the four region tabs (East, West, North, and South), I list the name of the tab by way of this formula:

=MID(CELL("FILENAME",Margin!A1),FIND("]",CELL("FILENAME",Margin!A1))+1,255)

On the Assumptions tab, I have named ranges, East, West, North, and South.

On my regional tabs, I am doing calculations by referencing these ranges and using OFFSET (eg. =OFFSET(East,0,1,1,1)*25%).

I am wondering if, rather than keying in the range name, I could reference it from cell A2 (eg. =OFFSET(????,0,1,1,1)*25%).

I'm not sure what formula, if any, I could put in place of the ???? such to make offset access the range "listed" in cell A2.

Any thoughts?

Thanks.

 

Excel refer to cell in named range

Aladin Akyurek

MrExcel MVP

JoinedFeb 14, 2002Messages85,210

  • Nov 10, 2003
  • #2

If East, West, North, and South are defined as referring to definite ranges (e.g., using the Name Box), then...

=OFFSET(INDIRECT(A2),0,1,1,1)*25%

will simply work, although the volatilty score of your spreadsheet will rise.

If East, etc. are defined by means of a dynamic formula with OFFSET or INDEX, you'll need to switch from INDIRECT to EVAL...

=OFFSET(EVAL(A2),0,1,1,1)*25%

Otherwise, you'll get a #REF! error.

EVAL is available in the morefunc add-in.

 

Create Excel names that refer to cells, a constant value, or a formula. Use names in formulas, or quickly select a named range. Have fun with names too, and add strange characters, like a happy face!

Excel Names - Introduction

In Microsoft Excel, you can create names that refer to:

  • Cell(s) on the worksheet
  • Specific value
  • Formula

After you define Excel names, you can:

  • Use those names in a formula, instead of using a constant value or cell references.
  • Type a name, to quickly go to that named range of cells
  • Use the names as a source for the items in a data validation drop down list

The instructions below show how to create names and use names in your Excel files. Get the sample Excel workbook, to follow along with the instructions.

NOTE: To create a quick list of all the names in a workbook, see the Quick List of Names - No Macro instructions.

How to Name Cells

Watch this short video to see how to name a group of cells. Then, go to that named group of cells, or use the name in a formula. The written instructions are below the video. TOP

Name Cells - Name Box

You quickly name the selected cells by typing in the Name Box. NOTE: There are a few rules for Excel names, shown in the section below.

  1. Select the cell(s) to be named
  2. Click in the Name box, to the left of the formula bar
  3. Type a valid one-word name for the list, e.g. FruitList.
  4. Press the Enter key.

Excel refer to cell in named range

Rules for Creating Names

There are rules for Excel names on the Microsoft site, and I have briefly summarized those rules below.

However, despite these strict rules, some unusual characters are allowed in Excel names. There ahe examples of what is allowed, in the Strange Characters in Excel Names section, further donw on this page..

  • The first character of a name must be one of the following characters:
    • letter
    • underscore (_)
    • backslash (\).
  • Remaining characters in the name can be
    • letters
    • numbers
    • periods
    • underscore characters
  • The following are not allowed:
    • Space characters are not allowed as part of a name.
    • Names can't look like cell addresses, such as A$35 or R2D2
    • C, c, R, r -- can't be used as names -- Excel uses them as selection shortcuts
  • Names are not case sensitive. For example, North and NORTH are treated as the same name.

See Names on Worksheet

The best way to see all the names that you've created is by using the Name Manager. The steps for that are in the next section, below.

However, there are 2 ways that you can also see the names on the worksheet:

--- 1) Create a List of Names

--- 2) See Named Ranges by Zooming

Create List of Names on Worksheet

You can create a list of names on a worksheet, with a few easy steps. This is a quick way to double-check the names in the Excel file, and to see their Refers To formulas

Excel refer to cell in named range

To create the list, follow these steps:

  • Insert a new worksheet, or select a cell in a blank area of an existing worksheet.
  • On the Excel Ribbon, click the Formulas tab.
  • In the Defined Names group, click Use in Formula
  • At the bottom of the list of names, click Paste Names
  • In the Paste Name dialog box, click Paste List

A 2-column list of names will be inserted, starting in the selected cell, so make sure you have room for your list

What’s in the List?

The list of names will contain all the workbook level names, unless there’s a duplicate sheet level name on the sheet where the name list is pasted.

In that case, the sheet level name appears in the list, instead of the workbook level name.

See Named Ranges by Zooming

To see some of the named ranges on a worksheet, use this quick trick:

  • At the bottom right of the Excel window, click the Zoom Level setting
  • In the Zoom dialog box, select Custom
  • Type 39 in the percentage box, and click OK
  • Excel refer to cell in named range

The names of some ranges will appear on the worksheet, in blue text, like the MonthList in this screen shot.

  • Names created with a formula, like YearList, won't appear.
  • Some ranges might be too small to show their name

Excel refer to cell in named range

See Names in Name Manager

To see details on all the names in the entire workbook, use the built-in Excel Name Manager tool.

To open the Name Manager, follow these steps

  1. On the Ribbon, click the Formulas tab
  2. In the Defined Names group, click Name Manager

OR, open the Name Manager with the keyboard shortcut Ctrl + F3

Name Manager Dialog Box

The Name Manager dialog box opens, showing a list of workbook level and worksheet level names.

  1. In the list, click on the name that you want to see details for
  2. At the bottom, the Refers To box shows the location of that named range, or a formula, if the name is not a range of cells

Delete an Excel Name

After you create a named range, you might need to delete that Excel name later. Sometimes, a name is no longer needed in a workbook.

Follow these steps to delete a name in Excel:

  1. On the Excel Ribbon, click the Formulas tab
  2. Click Name Manager
  3. In the list, click on the name that you want to delete
  4. At the top of the Name Manager, click the Delete button.
  5. A confirmation message appears, asking "Are you sure you want to delete the name ___?"
  6. To delete the name, click the OK button, or click the Cancel button, if you change your mind.
  7. Click Close, to close the Name Manager

Change a Named Range

After you create a named range, you might need to change the cells that it refers to. This short video shows the steps, and there are written steps below the video.

Follow these steps to change the range reference:

  1. On the Ribbon, click the Formulas tab
  2. Click Name Manager
  3. In the list, click on the name that you want to change
  4. In the Refers To box, change the range reference, or drag on the worksheet, to select the new range.
  5. Click the check mark, to save the change
  6. Click Close, to close the Name Manager TOP

Excel refer to cell in named range

Create Names from Cell Text

To quickly name individual cells, or individual ranges, you can use heading cell text as the names. Watch this video to see the steps. Written instructions are below the video.

Create Names from Cell Text

A quick way to create names is to base them on heading cell text (worksheet labels). In the example shown below, the cells in column E will be named, based on the labels in column D.

Excel refer to cell in named range

Notes on Creating Names from Cell Text

The cell text might be altered slightly, when the name is created. For example:

  • If the labels contains space characters, those spaces are replaced with an underscore.
  • Other invalid characters, such as & (ampersand) and # (number sign) will be removed, or replaced by an underscore character.

For more information on invalid characters, see the section above - Rules for Excel Names

Steps to Create Names from Cell Text

To name cells, or ranges, based on worksheet labels, follow these steps:

  • Select the labels and the cells that are to be named.
    • The labels can be above, below, left or right of the cells to be named.
    • In this example, the labels are in column B, to the left of the cells that will be named.

Excel refer to cell in named range

  • On the Excel Ribbon, click the Formulas tab
  • Then, in the Defined Names group, click Create from Selection.

Excel refer to cell in named range

In the Create Names From Selection window, there is is heading, "Create Names From Values in the"

Below that heading, there 4 check boxes:

  • Top Row
  • Left Column
  • Bottom Row
  • Right Column

To create the names:

  • In the dialog box, add a check mark to one or more of the cell locations, so the name will use text from those cells.
  • Click the OK button, to create the names

One Location Selected

For example, in the screen shot below:

  • label text is in the left column of the selected cells.
  • Left column option has a check mark

Excel refer to cell in named range
Five names will be created: Full_Name, Street, City, Province, Postal_Code

Click on a cell to see its name.

  • In the screen shot below, cell C4 is selected, and you can see its name in the Name Box -- Full_Name.
  • The space character was replaced with an underscore.

Excel refer to cell in named range

Two Locations Selected

For the next example, in the screen shot below, two locations are selected:

When multiple locations are selected for the cell text, names are created for each selected location.

In the example shown below, 4 names will be created:

  • Store: C3:D3
  • Manager: C4:D4
  • East: C3:C4
  • West: D3:D4

Excel refer to cell in named range

All Four Locations Selected

For the next example, in the screen shot below, all four of the locations are selected:

  • Top Row
  • Left column
  • Bottom Row
  • Right column

A name is created for all 8 of the label text cells:

  • North, South, City, Stores, Old, New, Market Count

Excel refer to cell in named range
Each named range includes the non-label cells adjacent to it. For example, both the City name and the Market name refer to the same two cells

Excel refer to cell in named range

Create Name for a Value

Most Excel names refer to ranges on the worksheet, but names can also be used to store a value.

Frequently Used Values

For example, create a name to store a percentage amount that you use frequently, such as a retail tax rate:

  • Name: TaxRate
  • Refers To: =0.5

Then, use that name in formulas, instead of typing in the value

Excel refer to cell in named range

Special Values

You can also create names to store values that are difficult to enter. For example, some formulas use this strange-looking number. According to Excel specifications on the Microsoft site, that is the largest positive number that you can type into an Excel cell.

Instead of typing that number into your formulas, you could define a name, using that value (copy the number from this page before you create the name):

  • Name: XL_Max
  • Refers To: 9.99999999999999E+307

Excel refer to cell in named range

Then, use the XL_Max name in formulas, like this LOOKUP formula that finds the last number in a column.

=LOOKUP(9.99999999999999E+307, WeightData[Wt])

Excel refer to cell in named range

How to Use Excel Names

After creating names, you can use them:

If a name refers to a range, you can select that name in the Name Box dropdown list, to select the named range on the worksheet.

NOTE: If a name does not appear in the drop down list, you can type the name instead

Excel refer to cell in named range

Use Names in Formulas

You can also use names in formulas. For example, you could have a group of cells with quantities sold. Name those cells Quantity, then use this formula to calculate the total amount:

=SUM(Quantity)

Excel refer to cell in named range

Name Box Tricks

In addition to using the Name Box to create a named range, or to select a named range, here are a few other Name Box tricks.

Resize the Name Box

In old versions of Excel, the Name Box was a set width, and you couldn't change that. Here's how you can adjust the Name Box width in newer versions:

  • Point to the 3-dot button at the right side of the Name Box
  • When the pointer changes to a 2-headed arrow, drag left or right, to change the width

Excel refer to cell in named range

Select Cells

Another handy trick is that you can use the Name Box to select unnamed cells too. Here are a couple of ways that trick can be useful -- unhide columns, or fill a long range of cells.

Unhide Columns

Here's a quick way to unhide specific columns, and leave others hidden.

  • Hide columns A to J
  • Click in the Name Box
  • Type a1,e1,h1 in the Name Box, and press Enter
    • Excel refer to cell in named range
  • Then use the Unhide command to show the selected columns
    • Home tab> Format> Hide & Unhide> Unhide Columns
    • Excel refer to cell in named range

Fill Cells

With Excel's AutoFill feature, you can create a list of dates, or numbers, or other sequences, very quickly. Just type one or two values as the starting sequence, select those cells, and double-click the Fill Handle to fill down to the last row of data.

Sometimes though, there's no data in the adjacent column, so AutoFill won't work with a double-click. You could drag the Fill Handle down, but that's not very efficient if you need to create a long series.

Here's how to create a list of 1000 numbers in column A:

  • Click in the Name Box
  • Type a1:a1000 in the Name Box, and press Enter
  • With the cells selected, type the number 1, and press Ctrl+Enter
  • Next, select cell A1, and type the 1st number in your series, e.g. 5
  • Select cell A2, and type the 2nd number in your series, e.g. 10
  • Select cells A1 and A2, and double-click the Fill Handle, to create the series of 1000 numbers

Excel refer to cell in named range

Create a Dynamic Named Range

If the list that you want to name will change frequently, having items added and removed, you should create a dynamic named range. A dynamic named range will automatically adjust in size, when the list changes. Here are two ways to create a dynamic named range:

Use a Named Excel Table

Use a Formula

Use a Named Excel Table

The easiest way to create a dynamic named range is to start by creating a named Excel table. Then, define a range based on one or more columns in that table.

In this example there is a list of parts on the worksheet, and a named table, and dynamic named ranges will be created. Later, if you add new items to the table, the named range will automatically expand.

First, create the table:

  1. Select a cell in the parts list
  2. On the Ribbon's Insert tab, click Table
  3. Check that the correct range has been selected, and add a check mark to My Table Has Headers
  4. Click OK, to create the table.
  5. Excel refer to cell in named range

  6. (optional) Change the table's default name (e.g. Table1) to a meaningful name, such as tblParts
  7. Excel refer to cell in named range

Next, create a dynamic list of part IDs:

  1. Select cells A2:A9, which contain the Part IDs (not the heading)
  2. Click in the Formula Bar, and type a one-word name for the range: PartIDList
  3. Press the Enter key, to complete the name.

Excel refer to cell in named range

To see the name's definition, follow these steps:

  • Click the Ribbon's Formulas tab, and click Name Manager.
  • There are two named items in the list:
    1. the Parts table, with the default name, Table1 (or the name that you gave to the table)
    2. the PartIDList, which is based on the PartID field in Table1.

Excel refer to cell in named range

Text the Dynamic Range

Because the PartIDList named range is based on a named table, the list will automatically adjust in size if you add or remove part IDs in the list.

  • Add a new item in the list of Part IDs
  • In the Name Box, select the PartIDList name
  • The named range is selected, and it includes the new Part ID. TOP

Excel refer to cell in named range

Dynamic Named Range - Formula

When you create a named range in Excel, it doesn't automatically include new items. If you plan to add new items to a list, you can use a dynamic formula to define an Excel named range. Then, as new items are added to the list, the named range will automatically expand to include them.

The written instructions are below the video.

Dynamic Named Range Based on Formula

If you don't want to use a named table, you can use a dynamic formula to define a named range. As new items are added, the range will automatically expand.

Note: Dynamic named ranges will not appear in the Name Box dropdown list. However, you can type the names in the Name Box, to select that range on the worksheet.

  1. On the Ribbon, click the Formulas tab
  2. Click Define Name
  3. Type a name for the range, e.g. NameList
  4. Leave the Scope set to Workbook.
  5. Excel refer to cell in named range

  6. In the Refers To box, enter an Offset formula that defines the range size, based on the number of items in the column, e.g.:
    =OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A),1)
    In this example, the list is on Sheet1, starting in cell A1
    The arguments used in this Offset function are:
    • Reference cell: Sheet1!$A$1
    • Rows to offset: 0
    • Columns to offset: 0
    • Number of Rows: COUNTA(Sheet1!$A:$A)
    • Number of Columns: 1
    • Note: for a dynamic number of columns, replace the 1 with:
                  COUNTA(Sheet1!$1:$1)
  7. Click OK TOP

Strange Characters Allowed in Excel Names

Even though Microsoft’s rules for Excel names say that you must use only letters, numbers, periods, underscores and backslashes, other characters are allowed.

Based on testing, "letters" has a broad interpretation, and goes well beyond the basic letters of the alphabet. You can use a wide variety of Unicode characters too!

For example, the screen shot below shows Excel names created by Peter B. He used Unicode text in his Excel names (shown below), to create arrows and subscript in Excel names, for a statistics workbook.

Excel refer to cell in named range

More Fun with Excel Names

Inspired by Peter’s examples, I did a few simple name tests, using characters created with the Alt key and Number keypad. For example:

  • In the Name Box, I typed the lower-case letter “a” , then Alt+1, Alt+30 and Alt+31 (use the number keypad), The Alt key combonations created a happy face, up arrow, and down arrow in the name
  • In another test, Excel used characters from cell D2, when I created a name using the Create From Selection technique on that range.
  • In the Name Manager, I created a couple of names with Unicode characters. The special characters showed up correctly in the Name Manager, but appear as question marks in the Name Box drop down list.

In the screen shot below, you can see the list of unconventional names that I created.

Excel refer to cell in named range

In-Depth Excel Name Testing

For an in-depth look at what characters are allowed in Excel names, see Martin Trummer's GitHub project excel-names.

Martin has done an in-depth study of what’s allowed, beyond the basic letters and numbers. When you visit Martin's GitHub page, you'll find written examples, and an Excel file to download.

Here is a screen shot from Martin's Excel file, with his test results.

Excel refer to cell in named range

Get the Sample File

To follow along with the instructions on this page, download the Excel Names Sample File. The zipped file is in xlsx format, and does not contain any macros. TOP

How do you reference a cell in a named range Excel?

Just select the name of interest in the Excel Name Manager, and type a new reference directly in the Refers to box, or click the button at the right and select the desired range on the sheet. After you click the Close button, Excel will ask if you want to save the changes, and you click Yes. Tip.

Can you use a cell to reference a named range?

Named Ranges provide meaning to the cells in an Excel worksheet. A named range can refer to a single cell, an area of cells or cells that are scattered throughout a worksheet. Named ranges can then be used in place of cryptic cell references in formulas and VBA code.

How do you select a specific cell in a named range?

Select named or unnamed cells or ranges by using the Go To command.
Press F5 or CTRL+G to launch the Go To dialog..
In the Go to list, click the name of the cell or range that you want to select, or type the cell reference in the Reference box, then press OK..

How do you refer to a named range?

Refer to this named range by just the name in the same worksheet, but from another worksheet you must use the worksheet name including "!" the name of the range (example: the range "Name" "=Sheet1! Name").