How To Create Names For Cells In Excel
Excel Names - Named Ranges
Create Excel names that refer to cells, a constant value, or a formula. Use names in formulas, or quickly select a named range.
Excel Names - Introduction
In 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
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
- Select the cell(s) to be named
- Click in the Name box, to the left of the formula bar
- Type a valid one-word name for the list, e.g. FruitList.
- Press the Enter key.
Rules for Creating Names
There are rules for Excel names on the Microsoft site, and those are summarized below.
For an in-depth look at what characters are allowed, see Martin Trummer's GitHub project excel-names -- it has written examples, and an Excel file to download.
Follow these rules from Microsoft, when you're creating a name in Excel.
- 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 the Names
NOTE: To create a quick list of all the names in a workbook, see the Quick List of Names - No Macro instructions.
To see some of the named ranges on a worksheet, use this 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
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
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:
- On the Ribbon, click the Formulas tab
- Click Name Manager
- In the list, click on the name that you want to change
- In the Refers To box, change the range reference, or drag on the worksheet, to select the new range.
- Click the check mark, to save the change
- Click Close, to close the Name Manager TOP
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.
NOTE: If the labels contains spaces, those are replaced with an underscore. Other invalid characters, such as & and # will be removed, or replaced by an underscore character.
To name cells, or ranges, based on worksheet labels:
- 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.
- On the Ribbon, click the Formulas tab, then click Create from Selection.
- In the Create Names From Selection window, add a check mark for the location of the labels, then click OK. In this example, the labels are in the left column of the selected cells.
- 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.
NOTE: The space character was replaced with an underscore.
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
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.
- 9.99999999999999E+307
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
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])
How to Use Excel Names
After creating names, you can use them:
- for quick navigation
- in formulas
Use Names for Quick Navigation
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
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)
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
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.
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
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:
- Select a cell in the parts 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.
- (optional) Change the table's default name (e.g. Table1) to a meaningful name, such as tblParts
Next, create a dynamic list of part IDs:
- Select cells A2:A9, which contain the Part IDs (not the heading)
- Click in the Formula Bar, and type a one-word name for the range: PartIDList
- Press the Enter key, to complete the name.
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:
- the Parts table, with the default name, Table1 (or the name that you gave to the table)
- the PartIDList, which is based on the PartID field in Table1.
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
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.
- On the Ribbon, click the Formulas tab
- Click Define Name
- Type a name for the range, e.g. NameList
- Leave the Scope set to Workbook.
- 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) - Click OK TOP
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
Related Links
Using Names in Formulas
Named Excel Tables
Excel Names Macros
Create Dynamic Ranges With a Macro
How To Create Names For Cells In Excel
Source: https://www.contextures.com/xlnames01.html
Posted by: compoorwastincer.blogspot.com
0 Response to "How To Create Names For Cells In Excel"
Post a Comment