Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Using the Same Range Name on Different Worksheets.
Written by Allen Wyatt (last updated February 4, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021
One of the handy features of Excel is that you can define names that refer to ranges of cells. (This is a big plus when you want to write formulas that make sense.) When you create a named range, Excel assumes that you want the name to be available from every worksheet within a workbook.
You can, however, specify that a name be valid only for the current worksheet. In this way you can define the same name on different worksheets in your workbook. Thus, you could have a range named MyRange on Sheet1, a range named MyRange on Sheet2, and also on Sheet3. To create names that are only applicable to a specific worksheet, follow these steps:
Figure 1. The New Name dialog box.
That's it. Now, if you go to a different worksheet, the name you defined will not be available from that worksheet—only from the worksheet in which it was defined.
There is a potential little quirk here that can lead to some interesting results. Note that in the "Refers To" box, the range shown is fully qualified—it shows the sheet on which you selected cells in step 1. If you select a different sheet in step 5, then your defined name is only available in whatever sheet you specified (in step 5), but it still refers to cells on a sheet other than that one. It will work just fine in your formulas, but it is just one potential "gotcha" you should watch for.
Finally, I should mention that there is a bit of shortcut you could use in the above-listed steps. You could also define the scope for your range name in this manner:
This approach—adding the sheet name to the beginning of the range name—results in the scope being set automatically to whatever sheet you specify.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12237) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Using the Same Range Name on Different Worksheets.
Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!
Excel includes several different methods of editing information in your cells. If you want to edit multiple cells all at ...
Discover MoreWhen you type information into a cell, Excel tries to figure out what type of information you are entering. If Excel can ...
Discover MoreDo you need to concatenate the contents of a range of cells in the same column? Here's a formula and a handy macro to ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2023-02-06 14:03:06
Mechie
I mentioned the free Add-In from Jan Karel Pieterse called Name Manager in the Excel Tip that J. Woolley references below. (https://jkp-ads.com/excel-name-manager.asp) Another one of its features is the ability to "localize" or "globalize" a Range Name. Very handy. Just one of its many features.
2023-02-04 17:14:33
David Gray
Another useful property of worksheet-scoped names that are scoped to the worksheet in which the referenced cells exist is that when you copy the worksheet, the locally scoped name comes with the copy. In this way, formulas that reference the name refer to the same cells in the new worksheet, very handy for such things as monthly tabulation worksheets.
2023-02-04 16:27:07
Tomek
Further to my earlier comment:
This works well for names with workbook scope. For ranges with sheet scope you would need to precede the range name with <SheetName!>
eg., Range("Sheet1!MyData")
but it would still work.
2023-02-04 16:08:30
Tomek
Range names are a very useful tool, if used properly. I would like to comment on use of the defined names in macros.
If you refer to a named range in a macro, eg., Range("MyData"), and then insert or delete rows, columns etc., which results in the named range to move to different address, the macro will still run correctly.
If, on another hand you refer to a range like Range("B7:H14") and that range gets moved, the macro will still refer to the same address B7:H14. Addresses of ranges or even single cells are not updated when the cells are moved or ranges expanded.
2023-02-04 14:11:47
Philip
Note thaï name scopes are nog supporter in Excel for Mac … (like so Manu otter features of Excel)
2023-02-04 09:59:31
J. Woolley
For related discussion, see https://excelribbon.tips.net/T013007_Checking_the_Scope_of_a_Defined_Name.html
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments