All About “Named Ranges” in Excel
Hello Super Excel Users,
In this post I am going to cover every aspect of Named Ranges.
What is a named range?
Cells are generally named for a column and row that intersect, like A1 or C3. A range of cells is indicated by the colon between the beginning and ending cell of the range, like A1:C3, which would include all nine cells in between. A named range substitutes a user-specified name, like “Marks,” for marks numbers typed in cells A1 through C3.
Creating a named range
Select one or more cells, and then click in the Name Box. It’s located left of the formula bar at the top of the worksheet, below the Ribbon. If you’re not sure you’re in the right place, hover and the Name Box tip will pop up.
Rules for Creating Names
An Excel name can’t contain space characters, and there are other rules to follow when you’re creating a name.
- The first character of a name must be a
- underscore (_)
- backslash (\).
- Remaining characters in the name can be
- underscore characters
- Spaces are not allowed as part of a name.
- Names can contain uppercase and lowercase letters, and Excel does not distinguish between them. For example, North and NORTH are treated as the same name.
- Names cannot be the same as a cell reference, such as A$35 or R2D2.
- You cannot use C,c,R or r as a defined name — they are used as selection shortcuts.
Benefits of Defining Named Ranges
1. Data Validation
Using a named range to create a dropdown list in a cell makes data entry easier and cleaner.
Without a named range, the list of acceptable choices must be in the same worksheet as the target cell. Using a named range allows you to put that list anywhere in your workbook.
Making a tab called “lists,” which holds all the named ranges used in selection lists, is helpful.
- From the Data tab, in the Data Tools group, choose the Data Validation button.
- Choose List selection in the Allow: field.
- In the Source field type an “=” and the name of your range as illustrated.
The easiest mistake to make here is to forget the equals sign.
A named range is the best choice when using an Absolute Cell Reference ($A$1) to refer your formula to the exact same cell (no matter where it’s copied).
In a VLookUp, for example, forgetting to set your Table Array to an absolute cell reference range can yield unpredictable results.
Simply setting a name range for your table array makes worrying about an absolute cell reference unnecessary. Even naming single cells can be helpful in creating a self-documenting formula.
If you have elaborate workbooks, which contain target figures like net profit, average cost and gross income, you can highlight the result cells and name them for what they represent. Then, click in the name box from anywhere in the workbook, select the name, and it will take you there.
Also, You can quickly move to a named area of your worksheet by choosing a name in the name box.
4. A meaningful range name (such as Income) is much easier to remember than a range address (such as A1:A10).
5. After you select a named cell or range, its name appears in the name box.
6. Creating formulas is easier, because you can paste a cell or range name into a formula. They are easier to write. Particularly, if you are referencing cells in another worksheet.
7. Names make your formulas more understandable and easier to use. For example, =Income-Expense is more intuitive than =A1-A10.
8. They are easier to explain. Especially, if you are sending an Excel Workbook to a client or a colleague.
Create Named Range from selection with Headings
- A quick way to create names is to base them on column/row headings. In the example shown in below video, the cells from row 2 onward will be named based on row 1 heading.
- Select the cells with heading that are to be named. The headings can be above, below, left or right of the cells to be named. In below example it is above the range.
- On the Ribbon, click the Formulas tab, then click Create from Selection.
- In the Create From Selection window, add a check mark for the location of the Heading, then click OK. In this example, the Headings are at top of the column of the selected cells.
- Select cells to see its name.
NOTE: If the labels contains spaces, they’re replaced with an underscore. Other invalid characters, such as & and # will be removed, or replaced by an underscore character.
Applying Names to existing Formulas
Using named ranges is a good practice. So we go ahead and created names for every cell/range in our complex workbook. But now, what about those formulas which still refer to cells by their addresses? Follow below steps to make formulas readable by replacing cell addresses with the names in one go.
- Select the cells containing formulas
- Go to Formulas > Define Name > Apply Names
- Hold Shift and select all the names
- Click OK
- Your formulas will now have names instead of cell references
See the video below to understand it.
Creating 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. Unlike a static named range, a dynamic named range will automatically adjust in size, when the list changes.
A dynamic list is ideal if you are creating a drop down list, and want new items shown automatically, or if you are creating a pivot table, and add new records frequently.
In Excel 2007 and later, 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.
First, to create the table:
- Select a cell in the Teams list
- On the Ribbon’s Insert tab, click Table
- Check that the correct range has been selected, and add a check mark to My Table Has Headers
- Click OK, to create the table.
Next, to create a dynamic list of Teams:
- Select cells A2:A15, which contain the Teams (not the heading)
- Click in the Formula Bar, and type a one-word name for the range: Teams
- Press the Enter key, to complete the name.
To see the name’s definition, click the Ribbon’s Formulas tab, and click Name Manager. There are two named items in the list — Teams Table, with the default name, Table1, and the Teams List, which is based on the Teams field in Table1.
Because the Teams named range is based on a named table, the list will automatically adjust in size if you add or remove Teams in the list.
NOTE: If you are using Excel 2003, which does not have named tables, 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 the range on the worksheet.
- Choose Insert>Name>Define
- Type a name for the range, e.g. NameList
- 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.:
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:
- Click OK
Thats all about NAMED RANGES. Please Let me know how you use Named Ranges in your workbook.
CA Dhaval Paun