Understanding Scope for Named Ranges

Written by Allen Wyatt (last updated June 3, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


1

Chuck can easily set up named ranges in a workbook, and Excel allows him to specify whether that named range should apply to the whole workbook or to a single worksheet. He wonders, though, about the pros and cons of limiting the scope of a named range to a single worksheet. That leads to the question of whether it is better than leaving the scope set to the entire workbook.

As Chuck implies, the default for a named range is that it applies to the entire workbook. For most people this is just fine, and it reflects the way that most people work with named ranges. There is no "performance hit" associated with either workbook scope or worksheet scope, so that (fortunately) does not enter into the equation.

So when should you veer from the default and, instead, choose to make a named range applicable to only a worksheet? The obvious answer is when you have a worksheet that you may want to duplicate within a workbook, the worksheet contains named ranges that refer to ranges on that worksheet, and that worksheet contains formulas that utilize those named ranges. When you duplicate the worksheet, you'll want those formulas on the multiple worksheets to still work relative to their worksheets. If the named ranges are limited in scope to the worksheet, then everything should work as expected.

If you duplicate a worksheet that includes named ranges that use the "workbook" scope, and that copy is within the same workbook, Excel makes a change in the copied worksheet. Specifically, to prevent confusion in the workbook namespace, Excel automatically converts the named ranges in the copy to have worksheet scope. The named ranges in the original worksheet remain unchanged and, therefore, retain a workbook scope.

If you duplicate a worksheet that includes named ranges that use the "workbook" scope, and that copy is placed in a different workbook, then Excel only modifies the scope of those ranges if keeping the original scope would cause a conflict with any named ranges already existing in the target workbook.

In all cases, you'll want to double-check any formulas in your worksheets to make sure that they refer to what you expect them to refer to. Conversely, you can change the named range scope to "worksheet" before doing the worksheet copying so that there is less chance of confusion with the duplicated or copied worksheets.

You should note two potential gotchas, though, when using named ranges scoped for a particular worksheet. First, when you start duplicating the worksheet, you make it a bit more difficult for a user to track down potential problems because of identically named ranges on different worksheets. (It just takes a bit more for the user to wrap their head around the limited scope.)

Second, it can make your macros more complex, if those macros access named ranges. If you have such macros, you'll want to test them thoroughly to make sure that they reference the expected ranges. If you don't, the macros may mess up your worksheet data or crash altogether.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (4633) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Setting Prime Height Spacing in the Equation Editor

The Equation Editor is a great tool for easily creating fancy-looking equations in your document. You can even control ...

Discover More

Workaround for Multiple Rows of Worksheet Tabs

If you've got a lot of worksheets in your workbook, you may want to display their tabs in to rows at the bottom of the ...

Discover More

Copying Headers or Footers within a Workbook

If you want to copy headers or footers from one worksheet to another, it is a relatively easy process, as described in ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

Functions that Can Access Closed Workbooks

When creating a workbook, you can include formulas that reference data stored in other workbooks. Some functions will ...

Discover More

Adding Up Tops and Bottoms

When you are working with sequenced values in a list, you’ll often want to take some action based on the top X or ...

Discover More

Looking Backward through a Data Table

Sometimes you need to look backward, through the information above your formula, to find the data you need. This can be ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is nine minus 1?

2023-06-03 15:22:50

J. Woolley

For related discussion, see my March 2023 comments here: https://excelribbon.tips.net/T010338_Getting_Rid_of_Unused_Range_Names.html


This Site

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.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.