Excel for Microsoft 365 Excel 2021 Excel 2019 Excel 2016 Excel 2013 Excel 2010 Excel 2007 Excel Starter 2010 More…Less
You can quickly create a named range by using a selection of cells in the worksheet.
Note: Named ranges that are created from selecting cells have a workbook-level scope.
-
Select the range you want to name, including the row or column labels.
-
Click Formulas > Create from Selection.
-
In the Create Names from Selection dialog box, select the checkbox (es) depending on the location of your row/column header. If you have only a header row at the top of the table, then just select Top row. Suppose you have a top row and left column header, then select Top row and Left column options, and so on.
-
Click OK.
Need more help?
You can always ask an expert in the Excel Tech Community or get support in the Answers community.
Need more help?
In this VBA Tutorial, you learn how to create named ranges (for different ranges and with different scopes) with macros.
This VBA Tutorial is accompanied by Excel workbooks containing the macros I use in the examples below. You can get immediate free access to these example workbooks by subscribing to the Power Spreadsheets Newsletter.
Use the following Table of Contents to navigate to the section you’re interested in.
Related VBA and Macro Tutorials
The following VBA and Macro Tutorials may help you better understand and implement the contents below:
- General VBA constructs and structures:
- Learn about commonly-used VBA terms here.
- Learn about working with Sub procedures here.
- Learn about the Excel VBA Object Model here.
- Learn about working with VBA methods here.
- Learn how to identify cell ranges here.
- Learn how to declare and work with variables here.
- Learn about VBA data types here.
- Learn about A1 and R1C1-style references here.
- Practical VBA applications and macro examples:
- Learn how to work with worksheets here.
- Learn several ways to find the last row with data here.
- Learn several ways to find the last column with data here.
You can find additional VBA and Macro Tutorials in the Archives.
VBA Code to Create Named Range
To create a named range using VBA, use a statement with the following structure:
Scope.Names.Add Name:=RangeName, RefersTo:=NamedRange
Process Followed by VBA to Create Named Range
VBA Statement Explanation
- Item: Scope.
- VBA Construct: Workbook or Worksheet object.
- Description: Scope of the named range you create. The scope of a named range can generally be 1 of the following:
- Workbook. In this case, Scope must represent a Workbook object. For these purposes, you can use VBA constructs such as the ActiveWorkbook property, the ThisWorkbook property or the Application.Workbooks property.
- Worksheet. In this case, Scope must represent a Worksheet object. For these purposes, you can use VBA constructs such as the ActiveSheet property or the Workbook.Worksheets property.
For a more detailed description of how to create a named range with worksheet scope, please refer to the appropriate section below.
- Item: Names.
- VBA Construct: Workbook.Names property (when Scope is a Workbook object) or Worksheet.Names property (when scope is a Worksheet object).
- Description: The Names property returns a Names collection representing all the names in the workbook (when Scope is a Workbook object) or worksheet (when Scope is a Worksheet object) represented by Scope. The Names collection returned by the Workbook.Names property includes worksheet-specific names.
- Item: Add.
- VBA Construct: Names.Add method.
- Description: The Names.Add method sets a new name for a cell range.
- Item: Name:=RangeName.
- VBA Construct: Name parameter of the Names.Add method.
- Description: The Name parameter of the Names.Add method allows you to specify the name of the named range you specify. Consider the following usual requirements when specifying RangeName:
- RangeName must start with a letter or underscore.
- Certain characters aren’t allowed. For example, RangeName can’t include spaces.
- RangeName can’t conflict with an existing name.
- RangeName can’t be formatted as a cell reference. For example, names such as “ABC1” aren’t allowed.
- If you want to specify the Name parameter using localized text, (i) work with the NameLocal parameter of the Names.Add method, and (ii) omit the Name parameter of the Names.Add method.
If you explicitly declare a variable to represent RangeName, use the String data type.
- Item: RefersTo:=NamedRange.
- VBA Construct: RefersTo parameter of the Names.Add method.
- Description: The RefersTo parameter of the Names.Add method allows you to specify the cell range to which the name refers to. The RefersTo parameter is of the Variant data type. Therefore, you commonly specify NamedRange as one of the following:
- A Range object.
- A string that uses the A1-style notation.
When working with the Names.Add method, you can also specify the cell range to which the name refers to using the following parameters.
- RefersToLocal: Allows you to specify the cell range in localized text using the A1-style notation.
- RefersToR1C1: Allows you to specify the cell range in R1C1-style notation.
- RefersToR1C1Local: Allows you to specify the cell range in localized text using the R1C1-style notation.
When working with one of the 4 parameters I refer to (RefersTo, RefersToLocal, RefersToR1C1, or RefersToR1C1Local), specify that single parameter and omit the others.
If you explicitly declare a variable to represent NamedRange, use the Range object data type (if specifying NamedRange as a Range object) or the String data type (if specifying NamedRange as a string).
Macro Example to Create Named Range
The following macro example creates a named range with workbook scope (ThisWorkbook) by setting the name of the cell range composed of cells A5 to C10 (myNamedRange) of the Named Range worksheet (myWorksheet) to “namedRange” (myRangeName).
Sub createNamedRange() 'Source: https://powerspreadsheets.com/ 'For further information: https://powerspreadsheets.com/vba-create-named-range/ 'declare object variables to hold references to worksheet containing cell range, and cell range itself Dim myWorksheet As Worksheet Dim myNamedRange As Range 'declare variable to hold defined name Dim myRangeName As String 'identify worksheet containing cell range, and cell range itself Set myWorksheet = ThisWorkbook.Worksheets("Named Range") Set myNamedRange = myWorksheet.Range("A5:C10") 'specify defined name myRangeName = "namedRange" 'create named range with workbook scope. Defined name and cell range are as specified ThisWorkbook.Names.Add Name:=myRangeName, RefersTo:=myNamedRange End Sub
Effects of Executing Macro Example to Create Named Range
The following image illustrates the results of executing the macro example. The cell range containing cells A5 to C10 is named as “namedRange”.
#2: Create Named Range with Worksheet Scope
VBA Code to Create Named Range with Worksheet Scope
To create a named range with worksheet scope using VBA, use a statement with the following structure:
Worksheet.Names.Add Name:=RangeName, RefersTo:=NamedRangeWorksheet
Process Followed by VBA to Create Named Range with Worksheet Scope
VBA Statement Explanation
- Item: Worksheet.
- VBA Construct: Worksheet object.
- Description: You can use VBA constructs such as the ActiveSheet property or the Workbook.Worksheets property to return a Worksheet object representing the worksheet to which you want to limit the scope of the named range.
- Item: Names.
- VBA Construct: Worksheet.Names property.
- Description: The Worksheet.Names property returns a Names collection representing all the names in Worksheet.
- Item: Add.
- VBA Construct: Names.Add method.
- Description: The Names.Add method sets a new name for a cell range.
- Item: Name:=RangeName.
- VBA Construct: Name parameter of the Names.Add method.
- Description: The Name parameter of the Names.Add method allows you to specify the name of the named range you specify. Consider the following usual requirements when specifying RangeName:
- RangeName must start with a letter or underscore.
- Certain characters aren’t allowed. For example, RangeName can’t include spaces.
- RangeName can’t conflict with an existing name.
- RangeName can’t be formatted as a cell reference. For example, names such as “ABC1” aren’t allowed.
- If you want to specify the Name parameter using localized text, (i) work with the NameLocal parameter of the Names.Add method, and (ii) omit the Name parameter of the Names.Add method.
If you explicitly declare a variable to represent RangeName, use the String data type.
- Item: RefersTo:=NamedRangeWorksheet.
- VBA Construct: RefersTo parameter of the Names.Add method.
- Description: The RefersTo parameter of the Names.Add method allows you to specify the cell range to which the name refers to. The RefersTo parameter is of the Variant data type. Therefore, you commonly specify NamedRangeWorksheet as one of the following:
- A Range object.
- A string that uses the A1-style notation.
When working with the Names.Add method, you can also specify the cell range to which the name refers to using the following parameters.
- RefersToLocal: Allows you to specify the cell range in localized text using the A1-style notation.
- RefersToR1C1: Allows you to specify the cell range in R1C1-style notation.
- RefersToR1C1Local: Allows you to specify the cell range in localized text using the R1C1-style notation.
When working with one of the 4 parameters I refer to (RefersTo, RefersToLocal, RefersToR1C1, or RefersToR1C1Local), specify that single parameter and omit the others.
If you explicitly declare a variable to represent NamedRangeWorksheet, use the Range object data type (if specifying NamedRangeWorksheet as a Range object) or the String data type (if specifying NamedRangeWorksheet as a string).
Macro Example to Create Named Range with Worksheet Scope
The following macro example creates a named range with worksheet scope (myWorksheet) by setting the name of the cell range composed of cells D5 to F10 (myNamedRangeWorksheet) of the Named Range worksheet (myWorksheet) to “namedRangeWorksheet” (myRangeName).
Sub createNamedRangeWorksheetScope() 'Source: https://powerspreadsheets.com/ 'For further information: https://powerspreadsheets.com/vba-create-named-range/ 'declare object variables to hold references to worksheet containing cell range, and cell range itself Dim myWorksheet As Worksheet Dim myNamedRangeWorksheet As Range 'declare variable to hold defined name Dim myRangeName As String 'identify worksheet containing cell range, and cell range itself Set myWorksheet = ThisWorkbook.Worksheets("Named Range") Set myNamedRangeWorksheet = myWorksheet.Range("D5:F10") 'specify defined name myRangeName = "namedRangeWorksheet" 'create named range with worksheet scope. Defined name and cell range are as specified myWorksheet.Names.Add Name:=myRangeName, RefersTo:=myNamedRangeWorksheet End Sub
Effects of Executing Macro Example to Create Named Range with Worksheet Scope
The following image illustrates the results of executing the macro example. The cell range containing cells D5 to F10 is named as “namedRangeWorksheet”.
#3: Create Named Range from Selection
VBA Code to Create Named Range from Selection
To create a named range from the current selection using VBA, use a statement with the following structure:
Scope.Names.Add Name:=RangeName, RefersTo:=Selection
Process Followed by VBA to Create Named Range from Selection
VBA Statement Explanation from Selection
- Item: Scope.
- VBA Construct: Workbook or Worksheet object.
- Description: Scope of the named range you create. The scope of a named range can generally be 1 of the following:
- Workbook. In this case, Scope must represent a Workbook object. For these purposes, you can use VBA constructs such as the ActiveWorkbook property, the ThisWorkbook property or the Application.Workbooks property.
- Worksheet. In this case, Scope must represent a Worksheet object. For these purposes, you can use VBA constructs such as the ActiveSheet property.
For a more detailed description of how to create a named range with worksheet scope, please refer to the appropriate section above.
- Item: Names.
- VBA Construct: Workbook.Names property (when Scope is a Workbook object) or Worksheet.Names property (when scope is a Worksheet object).
- Description: The Names property returns a Names collection representing all the names in the workbook (when Scope is a Workbook object) or worksheet (when Scope is a Worksheet object) represented by Scope. The Names collection returned by the Workbook.Names property includes worksheet-specific names.
- Item: Add.
- VBA Construct: Names.Add method.
- Description: The Names.Add method sets a new name for a cell range.
- Item: Name:=RangeName.
- VBA Construct: Name parameter of the Names.Add method.
- Description: The Name parameter of the Names.Add method allows you to specify the name of the named range you specify. Consider the following usual requirements when specifying RangeName:
- RangeName must start with a letter or underscore.
- Certain characters aren’t allowed. For example, RangeName can’t include spaces.
- RangeName can’t conflict with an existing name.
- RangeName can’t be formatted as a cell reference. For example, names such as “ABC1” aren’t allowed.
- If you want to specify the Name parameter using localized text, (i) work with the NameLocal parameter of the Names.Add method, and (ii) omit the Name parameter of the Names.Add method.
If you explicitly declare a variable to represent RangeName, use the String data type.
- Item: RefersTo:=Selection.
- VBA Construct: RefersTo parameter of the Names.Add method and Selection property.
- Description: The RefersTo parameter of the Names.Add method allows you to specify the cell range to which the name refers to.
The Selection property returns a Range object representing the current selected cells. This is the cell range you name.
Macro Example to Create Named Range from Selection
The following macro example creates a named range with workbook scope (ThisWorkbook) by setting the name of the selection (Selection) to “namedRangeFromSelection” (myRangeName).
Sub createNamedRangeFromSelection() 'Source: https://powerspreadsheets.com/ 'For further information: https://powerspreadsheets.com/vba-create-named-range/ 'declare variable to hold defined name Dim myRangeName As String 'specify defined name myRangeName = "namedRangeFromSelection" 'create named range with workbook scope. Defined name is as specified. Cell range is the selection ThisWorkbook.Names.Add Name:=myRangeName, RefersTo:=Selection End Sub
Effects of Executing Macro Example to Create Named Range from Selection
The following image illustrates the results of executing the macro example. The current selection, containing cells G5 to I10 is named as “namedRangeFromSelection”.
#4: Create Named Range (Dynamic)
VBA Code to Create Named Range (Dynamic)
To create a named range from a dynamic range (where the number of the last row and last column changes) with VBA, use a macro with the following statement structure:
Dim LastRow As Long Dim LastColumn As Long Dim NamedRangeDynamic As Range With Worksheet.Cells LastRow = .Find(What:="*", LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row LastColumn = .Find(What:="*", LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column Set NamedRangeDynamic = .Range(.Cells(1, 1), .Cells(LastRow, LastColumn)) End With Scope.Names.Add Name:=RangeName, RefersTo:=NamedRangeDynamic
Process Followed by VBA to Create Named Range (Dynamic)
VBA Statement Explanation (Dynamic)
Line #1: Dim LastRow As Long
- Item: Dim LastRow as Long.
- VBA Construct: Dim statement.
- Description: Declares the LastRow variable as of the Long data type.
LastRow holds the number of the last row with data in the worksheet containing the cell range you name (Worksheet).
Line #2: Dim LastColumn As Long
- Item: Dim LastColumn as Long.
- VBA Construct: Dim statement.
- Description: Declares the LastColumn variable as of the Long data type.
LastColumn holds the number of the last column with data in the worksheet containing the cell range you name (Worksheet).
Line #3: Dim NamedRangeDynamic As Range
- Item: Dim NamedRangeDynamic As Range.
- VBA Construct: Dim statement.
- Description: Declares the NamedRangeDynamic variable as of the Range object data type.
NamedRangeDynamic represents the cell range you name.
Lines #4 and #8:With Worksheet.Cells | End With
- Item: With… End With.
- VBA Construct: With… End With statement.
- Description: Statements within the With… End With statement are executed on the Range object returned by Worksheet.Cells.
- Item: Worksheet.
- VBA Construct: Worksheet object.
- Description: Represents the worksheet containing the cell range you name. If you explicitly declare an object variable to represent Worksheet, use the Worksheet object data type.
- Item: Cells.
- VBA Construct: Worksheet.Cells property.
- Description: Returns a Range object representing all the cells in Worksheet.
Line #5: LastRow = .Find(What:=”*”, LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
- Item: LastRow.
- VBA Construct: Variable of the long data type.
- Description: LastRow holds the number of the last row with data in Worksheet.
- Item: =.
- VBA Construct: Assignment operator.
- Description: Assigns the row number returned by the Range.Row property to the LastRow variable.
- Item: Find.
- VBA Construct: Range.Find method.
- Description: Returns a Range object representing the first cell where the information specified by the parameters of the Range.Find method (What, LookIn, LookAt, SearchOrder and SearchDirection) is found. Within this macro structure, this Range object represents the last cell with data in the last row with data in Worksheet.
- Item: What:=”*”.
- VBA Construct: What parameter of the Range.Find method.
- Description: Specifies the data the Range.Find method searches for. The asterisk (*) is a wildcard and, therefore, the Range.Find method searches for any character sequence.
- Item: LookIn:=xlFormulas.
- VBA Construct: LookIn parameter of the Range.Find method.
- Description: Specifies that the Range.Find method looks in formulas (xlFormulas).
- Item: LookAt:=xlPart.
- VBA Construct: LookAt parameter of the Range.Find method.
- Description: Specifies that the Range.Find method looks at (and matches) a part (xlPart) of the search data.
- Item: SearchOrder:=xlByRows.
- VBA Construct: SearchOrder parameter of the Range.Find method.
- Description: Specifies that the Range.Find method searches by rows (xlByRows).
- Item: SearchDirection:=xlPrevious.
- VBA Construct: SearchDirection parameter of the Range.Find method.
- Description: Specifies that the Range.Find method searches for the previous match (xlPrevious).
- Item: Row.
- VBA Construct: Range.Row property.
- Description: Returns the row number of the Range object returned by the Range.Find method. Within this macro structure, this row number corresponds to the last row with data in Worksheet.
Line #6: LastColumn = .Find(What:=”*”, LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
- Item: LastColumn.
- VBA Construct: Variable of the long data type.
- Description: LastColumn holds the number of the last column with data in Worksheet.
- Item: =.
- VBA Construct: Assignment operator.
- Description: Assigns the column number returned by the Range.Column property to the LastColumn variable.
- Item: Find.
- VBA Construct: Range.Find method.
- Description: Returns a Range object representing the first cell where the information specified by the parameters of the Range.Find method (What, LookIn, LookAt, SearchOrder and SearchDirection) is found. Within this macro structure, this Range object represents the last cell with data in the last column with data in Worksheet.
- Item: What:=”*”.
- VBA Construct: What parameter of the Range.Find method.
- Description: Specifies the data the Range.Find method searches for. The asterisk (*) is a wildcard and, therefore, the Range.Find method searches for any character sequence.
- Item: LookIn:=xlFormulas.
- VBA Construct: LookIn parameter of the Range.Find method.
- Description: Specifies that the Range.Find method looks in formulas (xlFormulas).
- Item: LookAt:=xlPart.
- VBA Construct: LookAt parameter of the Range.Find method.
- Description: Specifies that the Range.Find method looks at (and matches) a part (xlPart) of the search data.
- Item: SearchOrder:=xlByColumns.
- VBA Construct: SearchOrder parameter of the Range.Find method.
- Description: Specifies that the Range.Find method searches by columns (xlByColumns).
- Item: SearchDirection:=xlPrevious.
- VBA Construct: SearchDirection parameter of the Range.Find method.
- Description: Specifies that the Range.Find method searches for the previous match (xlPrevious).
- Item: Column.
- VBA Construct: Range.Column property.
- Description: Returns the column number of the Range object returned by the Range.Find method. Within this macro structure, this column number corresponds to the last column with data in Worksheet.
Line #7: Set NamedRangeDynamic = .Range(.Cells(1, 1), .Cells(LastRow, LastColumn))
- Item: NamedRangeDynamic.
- VBA Construct: Object variable of the Range object data type.
- Description: NamedRangeDynamic represents the cell range you name.
- Item: =.
- VBA Construct: Assignment operator.
- Description: Assigns the Range object returned by the Range.Range property to the NamedRangeDynamic object variable.
- Item: Range.
- VBA Construct: Range.Range property.
- Description: Returns a Range object representing the cell range you name. Within this macro structure, the Range property is applied to the Range object returned by the Worksheet.Cells property in the opening statement of the With… End With statement.
- Item: Cells(1, 1).
- VBA Construct: Cells1 parameter of the Range.Range property, Range.Cells property and Range.Item property.
- Description: The Cells1 parameter of the Range.Range property specifies the cell in the upper-left corner of the cell range. Within this macro structure, Cells1 is the Range object returned by the Range.Cells property.
The Range.Cells property returns all the cells within the cell range represented by the Range object returned by the Worksheet.Cells property in the opening statement of the With… End With statement. The Range.Item property is the default property and returns a Range object representing the cell on the first row and first column (Cells(1, 1)) of the cell range it works with.
Since the Worksheet.Cells property in the opening statement of the With… End With statement returns all the cells in Worksheet, this is cell A1 of Worksheet.
- Item: Cells(LastRow, LastColumn).
- VBA Construct: Cells2 parameter of the Range.Range property, Range.Cells property and Range.Item property.
- Description: The Cells2 parameter of the Range.Range property specifies the cells in the lower-right corner of the cell range. Within this macro structure, Cells2 is the Range object returned by the Range.Cells property.
The Range.Cells property returns all the cells within the cell range represented by the Range object returned by the Worksheet.Cells property in the opening statement of the With… End With statement (line #4 above). The Range.Item property is the default property and returns a Range object representing the cell located at the intersection of LastRow and LastColumn.
Since the Worksheet.Cells property in the opening statement of the With… End With statement returns all the cells in Worksheet, this is the cell located at the intersection of the last row and the last column (or the last cell with data) within Worksheet.
Line #9: Scope.Names.Add Name:=RangeName, RefersTo:=NamedRangeDynamic
- Item: Scope.
- VBA Construct: Workbook or Worksheet object.
- Description: Scope of the named range you create. The scope of a named range can generally be 1 of the following:
- Workbook. In this case, Scope must represent a Workbook object. For these purposes, you can use VBA constructs such as the ActiveWorkbook property, the ThisWorkbook property or the Application.Workbooks property.
- Worksheet. In this case, Scope must represent a Worksheet object. For these purposes, you can use VBA constructs such as the ActiveSheet property or the Workbook.Worksheets property.
For a more detailed description of how to create a named range with worksheet scope, please refer to the appropriate section above.
- Item: Names.
- VBA Construct: Workbook.Names property (when Scope is a Workbook object) or Worksheet.Names property (when scope is a Worksheet object).
- Description: The Names property returns a Names collection representing all the names in the workbook (when Scope is a Workbook object) or worksheet (when Scope is a Worksheet object) represented by Scope. The Names collection returned by the Workbook.Names property includes worksheet-specific names.
- Item: Add.
- VBA Construct: Names.Add method.
- Description: The Names.Add method sets a new name for a cell range.
- Item: Name:=RangeName.
- VBA Construct: Name parameter of the Names.Add method.
- Description: The Name parameter of the Names.Add method allows you to specify the name of the named range you specify. Consider the following usual requirements when specifying RangeName:
- RangeName must start with a letter or underscore.
- Certain characters aren’t allowed. For example, RangeName can’t include spaces.
- RangeName can’t conflict with an existing name.
- RangeName can’t be formatted as a cell reference. For example, names such as “ABC1” aren’t allowed.
- If you want to specify the Name parameter using localized text, (i) work with the NameLocal parameter of the Names.Add method, and (ii) omit the Name parameter of the Names.Add method.
If you explicitly declare a variable to represent RangeName, use the String data type.
- Item: RefersTo:=NamedRangeDynamic.
- VBA Construct: RefersTo parameter of the Names.Add method.
- Description: The RefersTo parameter of the Names.Add method allows you to specify the cell range to which the name refers to.
NamedRangeDynamic is an object variable of the Range object data type representing the cell range you name.
Macro Example to Create Named Range (Dynamic)
The following macro example creates a named range with workbook scope (ThisWorkbook) by dynamically identifying the last row (myLastRow) and last column (myLastColumn) with data in the Named Range worksheet (myWorksheet) and setting its name to “namedRangeDynamic” (myRangeName). In this case, the first cell of namedRangeDynamic is A11 (intersection of myFirstRow and myFirstColumn).
Sub createNamedRangeDynamic() 'Source: https://powerspreadsheets.com/ 'For further information: https://powerspreadsheets.com/vba-create-named-range/ 'declare object variable to hold reference to worksheet containing cell range Dim myWorksheet As Worksheet 'declare variables to hold row and column numbers that define named cell range (dynamic) Dim myFirstRow As Long Dim myLastRow As Long Dim myFirstColumn As Long Dim myLastColumn As Long 'declare object variable to hold reference to cell range Dim myNamedRangeDynamic As Range 'declare variable to hold defined name Dim myRangeName As String 'identify worksheet containing cell range Set myWorksheet = ThisWorkbook.Worksheets("Named Range") 'identify first row and first column of cell range myFirstRow = 11 myFirstColumn = 1 'specify defined name myRangeName = "namedRangeDynamic" With myWorksheet.Cells 'find last row and last column of source data cell range myLastRow = .Find(What:="*", LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row myLastColumn = .Find(What:="*", LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column 'specify cell range Set myNamedRangeDynamic = .Range(.Cells(myFirstRow, myFirstColumn), .Cells(myLastRow, myLastColumn)) End With 'create named range with workbook scope. Defined name is as specified. Cell range is as identified, with the last row and column being dynamically determined ThisWorkbook.Names.Add Name:=myRangeName, RefersTo:=myNamedRangeDynamic End Sub
Effects of Executing Macro Example to Create Named Range (Dynamic)
The following image illustrates the results of executing the macro example. The cell range containing data (Data) (cells A11 to I20) is named as “namedRangeDynamic”.
References to VBA Constructs Used in this VBA Tutorial
Use the following links to visit the appropriate webpage in the Microsoft Developer Network:
- Specify the scope of a named range (workbook or worksheet):
- Workbook object.
- Workbook.Names property.
- Application.ActiveWorkbook property.
- Application.ThisWorkbook property.
- Application.Workbooks property.
- Worksheet object.
- Worksheet.Names property.
- Application.ActiveSheet property.
- Workbook.Worksheets property.
- Identify the cell range to name:
- Range object.
- Worksheet.Range property.
- Worksheet.Cells property.
- Application.Selection property.
- Range.Range property.
- Range.Cells property.
- Range.Item property.
- Identify the last row or column with data in a worksheet:
- Range.Find method.
- Range.Row property.
- Range.Column property.
- Set a new named range:
- Names collection.
- Name object.
- Names.Add method.
- Range.Name property.
- Work with variables and data types:
- Dim statement.
- Set statement.
- Data types:
- String data type.
- Long data type.
Named ranges are one of these crusty old features in Excel that few users understand. New users may find them weird and scary, and even old hands may avoid them because they seem pointless and complex.
But named ranges are actually a pretty cool feature. They can make formulas *a lot* easier to create, read, and maintain. And as a bonus, they make formulas easier to reuse (more portable).
In fact, I use named ranges all the time when testing and prototyping formulas. They help me get formulas working faster. I also use named ranges because I’m lazy, and don’t like typing in complex references
The basics of named ranges in Excel
What is a named range?
A named range is just a human-readable name for a range of cells in Excel. For example, if I name the range A1:A100 «data», I can use MAX to get the maximum value with a simple formula:
=MAX(data) // max value
The beauty of named ranges is that you can use meaningful names in your formulas without thinking about cell references. Once you have a named range, just use it just like a cell reference. All of these formulas are valid with the named range «data»:
=MAX(data) // max value
=MIN(data) // min value
=COUNT(data) // total values
=AVERAGE(data) // min value
Video: How to create a named range
Creating a named range is easy
Creating a named range is fast and easy. Just select a range of cells, and type a name into the name box. When you press return, the name is created:
To quickly test the new range, choose the new name in the dropdown next to the name box. Excel will select the range on the worksheet.
Excel can create names automatically (ctrl + shift + F3)
If you have well structured data with labels, you can have Excel create named ranges for you. Just select the data, along with the labels, and use the «Create from Selection» command on the Formulas tab of the ribbon:
You can also use the keyboard shortcut control + shift + F3.
Using this feature, we can create named ranges for the population of 12 states in one step:
When you click OK, the names are created. You’ll find all newly created names in the drop down menu next to the name box:
With names created, you can use them in formulas like this
=SUM(MN,WI,MI)
Update named ranges in the Name Manager (Control + F3)
Once you create a named range, use the Name Manager (Control + F3) to update as needed. Select the name you want to work with, then change the reference directly (i.e. edit «refers to»), or click the button at right and select a new range.
There’s no need to click the Edit button to update a reference. When you click Close, the range name will be updated.
Note: if you select an entire named range on a worksheet, you can drag to a new location and the reference will be updated automatically. However, I don’t know a way to adjust range references by clicking and dragging directly on the worksheet. If you know a way to do this, chime in below!
See all named ranges (control + F3)
To quickly see all named ranges in a workbook, use the dropdown menu next to the name box.
If you want to see more detail, open the Name Manager (Control + F3), which lists all names with references, and provides a filter as well:
Note: in older versions of Excel on the Mac, there is no Name Manager, and you’ll see the Define Name dialog instead.
Copy and paste all named ranges (F3)
If you want a more persistent record of named ranges in a workbook, you can paste the full list of names anywhere you like. Go to Formulas > Use in Formula (or use the shortcut F3), then choose Paste names > Paste List:
When you click the Paste List button, you’ll see the names and references pasted into the worksheet:
See names directly on the worksheet
If you set the zoom level to less than 40%, Excel will show range names directly on the worksheet:
Thanks for this tip, Felipe!
Names have rules
When creating named ranges, follow these rules:
- Names must begin with a letter, an underscore (_), or a backslash ()
- Names can’t contain spaces and most punctuation characters.
- Names can’t conflict with cell references – you can’t name a range «A1» or «Z100».
- Single letters are OK for names («a», «b», «x», etc.), but the letters «r» and «c» are reserved.
- Names are not case-sensitive – «home», «HOME», and «HoMe» are all the same to Excel.
Named ranges in formulas
Named ranges are easy to use in formulas
For example, lets say you name a cell in your workbook «updated». The idea is you can put the current date in the cell (Ctrl + and refer to the date elsewhere in the workbook.
The formula in B8 looks like this:
="Updated: "& TEXT(updated, "ddd, mmmm d, yyyy")
You can paste this formula anywhere in the workbook and it will display correctly. Whenever you change the date in «updated», the message will update wherever the formula is used. See this page for more examples.
Named ranges appear when typing a formula
Once you’ve created a named range, it will appear automatically in formulas when you type the first letter of the name. Press the tab key to enter the name when you have a match and want Excel to enter the name.
Named ranges can work like constants
Because named ranges are created in a central location, you can use them like constants without a cell reference. For example, you can create names like «MPG» (miles per gallon) and «CPG» (cost per gallon) with and assign fixed values:
Then you can use these names anywhere you like in formulas, and update their value in one central location.
Named ranges are absolute by default
By default, named ranges behave like absolute references. For example, in this worksheet, the formula to calculate fuel would be:
=C5/$D$2
The reference to D2 is absolute (locked) so the formula can be copied down without D2 changing.
If we name D2 «MPG» the formula becomes:
=C5/MPG
Since MPG is absolute by default, the formula can be copied down column D as-is.
Named ranges can also be relative
Although named ranges are absolute by default, they can also be relative. A relative named range refers to a range that is relative to the position of the active cell at the time the range is created. As a result, relative named ranges are useful building generic formulas that work wherever they are moved.
For example, you can create a generic «CellAbove» named range like this:
- Select cell A2
- Control + F3 to open Name Manager
- Tab into ‘Refers to’ section, then type: =A1
CellAbove will now retrieve the value from the cell above wherever it is it used.
Important: make sure the active cell is at the correct location before creating the name.
Apply named ranges to existing formulas
If you have existing formulas that don’t use named ranges, you can ask Excel to apply the named ranges in the formulas for you. Start by selecting the cells that contain formulas you want to update. Then run Formulas > Define Names > Apply Names.
Excel will then replace references that have a corresponding named range with the name itself.
You can also apply names with find and replace:
Important: Save a backup of your worksheet, and select just the cells you want to change before using find and replace on formulas.
Key benefits of named ranges
Named ranges make formulas easier to read
The biggest single benefit to named ranges is they make formulas easier to read and maintain. This is because they replace cryptic references with meaningful names. For example, consider this worksheet with data on planets in our solar system. Without named ranges, a VLOOKUP formula to fetch «Position» from the table is quite cryptic:
=VLOOKUP($H$4,$B$3:$E$11,2,0)
However, with B3:E11 named «data», and H4 named «planet», we can write formulas like this:
=VLOOKUP(planet,data,2,0) // position
=VLOOKUP(planet,data,3,0) // diameter
=VLOOKUP(planet,data,4,0) // satellites
At a glance, you can see the only difference in these formulas in the column index.
Named ranges make formulas portable and reusable
Named ranges can make it much easier to reuse a formula in a different worksheet. If you define names ahead of time in a worksheet, you can paste in a formula that uses these names and it will «just work». This is a great way to quickly get a formula working.
For example, this formula counts unique values in a range of numeric data:
=SUM(--(FREQUENCY(data,data)>0))
To quickly «port» this formula to your own worksheet, name a range «data» and paste the formula into the worksheet. As long as «data» contains numeric values, the formula will work straightway.
Tip: I recommend that you create the needed range names *first* in the destination workbook, then copy in the formula as text only (i.e. don’t copy the cell that contains the formula in another worksheet, just copy the text of the formula). This stops Excel from creating names on-the-fly and lets you to fully control the name creation process. To copy only formula text, copy text from the formula bar, or copy via another application (i.e. browser, text editor, etc.).
Named ranges can be used for navigation
Named ranges are great for quick navigation. Just select the dropdown menu next to the name box, and choose a name. When you release the mouse, the range will be selected. When a named range exists on another sheet, you’ll be taken to that sheet automatically.
Named ranges work well with hyperlinks
Named ranges make hyperlinks easy. For example, if you name A1 in Sheet1 «home», you can create a hyperlink somewhere else that takes you back there.
To use a named range inside the HYPERLINK function, add a hash (#) in front of the named range:
=HYPERLINK("#home","take me home")
You can use this same syntax to create a hyperlink to a table:
=HYPERLINK("#Table1","Go to Table1")
Note: in older versions of Excel you can’t link to a table like this. However, you can define a name equal to a table (i.e. =Table1) and hyperlink to that.
Named ranges for data validation
Names ranges work well for data validation, since they let you use a logically named reference to validate input with a drop down menu. Below, the range G4:G8 is named «statuslist», then apply data validation with a List linked like this:
The result is a dropdown menu in column E that only allows values in the named range:
Dynamic Named Ranges
Names ranges are extremely useful when they automatically adjust to new data in a worksheet. A range set up this way is referred to as a «dynamic named range». There are two ways to make a range dynamic: formulas and tables.
Dynamic named range with a Table
A Table is the easiest way to create a dynamic named range. Select any cell in the data, then use the shortcut Control + T:
When you create an Excel Table, a name is automatically created (e.g. Table1), but you can rename the table as you like. Once you have created a table, it will expand automatically when data is added.
Dynamic named range with a formula
You can also create a dynamic named range with formulas, using functions like OFFSET and INDEX. Although these formulas are moderately complex, they provide a lightweight solution when you don’t want to use a table. The links below provide examples with full explanations:
- Example of dynamic range formula with INDEX
- Example of dynamic range formula with OFFSET
Table names in data validation
Since Excel Tables provide an automatic dynamic range, they would seem to be a natural fit for data validation rules, where the goal is to validate against a list that may be always changing. However, one problem with tables is that you can’t use structured references directly to create data validation or conditional formatting rules. In other words, you can’t use a table name in conditional formatting or data validation input areas.
However, as a workaround, you can define named a named range that points to a table, and then use the named range for data validation or conditional formatting. The video below runs through this approach in detail.
Video: How to use named ranges with tables
Deleting named ranges
Note: If you have formulas that refer to named ranges, you may want to update the formulas first before removing names. Otherwise, you’ll see #NAME? errors in formulas that still refer to deleted names. Always save your worksheet before removing named ranges in case you have problems and need to revert to the original.
Named ranges adjust when deleting and inserting cells
When you delete *part* of a named range, or if insert cells/rows/columns inside a named range, the range reference will adjust accordingly and remain valid. However, if you delete all of the cells that enclose a named range, the named range will lose the reference and display a #REF error. For example, if I name A1 «test», then delete column A, the name manager will show «refers to» as:
=Sheet1!#REF!
Delete names with Name Manager
To remove named ranges from a workbook manually, open the name manager, select a range, and click the Delete button. If you want to remove more than one name at the same time, you can Shift + Click or Ctrl + Click to select multiple names, then delete in one step.
Delete names with errors
If you have a lot of names with reference errors, you can use the filter button in the name manager to filter on names with errors:
Then shift+click to select all names and delete.
Named ranges and Scope
Named ranges in Excel have something called «scope», which determines whether a named range is local to a given worksheet, or global across the entire workbook. Global names have a scope of «workbook», and local names have a scope equal to the sheet name they exist on. For example, the scope for a local name might be «Sheet2».
The purpose of scope
Named ranges with a global scope are useful when you want all sheets in a workbook to have access to certain data, variables, or constants. For example, you might use a global named range a tax rate assumption used in several worksheets.
Local scope
Local scope means a name is works only on the sheet it was created on. This means you can have multiple worksheets in the same workbook that all use the same name. For example, perhaps you have a workbook with monthly tracking sheets (one per month) that use named ranges with the same name, all scoped locally. This might allow you to reuse the same formulas in different sheets. The local scope allows the names in each sheet to work correctly without colliding with names in the other sheets.
To refer to a name with a local scope, you can prefix the sheet name to the range name:
Sheet1!total_revenue
Sheet2!total_revenue
Sheet3!total_revenue
Range names created with the name box automatically have global scope. To override this behavior, add the sheet name when defining the name:
Sheet3!my_new_name
Global scope
Global scope means a name will work anywhere in a workbook. For example, you could name a cell «last_update», enter a date in the cell. Then you can use the formula below to display the date last updated in any worksheet.
=last_update
Global names must be unique within a workbook.
Local scope
Locally scoped named ranges make sense for worksheets that use named ranges for local assumptions only. For example, perhaps you have a workbook with monthly tracking sheets (one per month) that use named ranges with the same name, all scoped locally. The local scope allows the names in each sheet to work correctly without colliding with names in the other sheets.
Managing named range scope
By default, new names created with the namebox are global, and you can’t edit the scope of a named range after it’s created. However, as a workaround, you can delete and recreate a name with the desired scope.
If you want to change several names at once from global to local, sometimes it makes sense to copy the sheet that contains the names. When you duplicate a worksheet that contains named ranges, Excel copies the named ranges to the second sheet, changing the scope to local at the same time. After you have the second sheet with locally scoped names, you can optionally delete the first sheet.
Jan Karel Pieterse and Charles Williams have developed a utility called the Name Manager that provides many useful operations for named ranges. You can download the Name Manager utility here.
What’s in the name?
If you are working with Excel spreadsheets, it could mean a lot of time saving and efficiency.
In this tutorial, you’ll learn how to create Named Ranges in Excel and how to use it to save time.
Named Ranges in Excel – An Introduction
If someone has to call me or refer to me, they will use my name (instead of saying a male is staying in so and so place with so and so height and weight).
Right?
Similarly, in Excel, you can give a name to a cell or a range of cells.
Now, instead of using the cell reference (such as A1 or A1:A10), you can simply use the name that you assigned to it.
For example, suppose you have a data set as shown below:
In this data set, if you have to refer to the range that has the Date, you will have to use A2:A11 in formulas. Similarly, for Sales Rep and Sales, you will have to use B2:B11 and C2:C11.
While it’s alright when you only have a couple of data points, but in case you huge complex data sets, using cell references to refer to data could be time-consuming.
Excel Named Ranges makes it easy to refer to data sets in Excel.
You can create a named range in Excel for each data category, and then use that name instead of the cell references. For example, dates can be named ‘Date’, Sales Rep data can be named ‘SalesRep’ and sales data can be named ‘Sales’.
You can also create a name for a single cell. For example, if you have the sales commission percentage in a cell, you can name that cell as ‘Commission’.
Benefits of Creating Named Ranges in Excel
Here are the benefits of using named ranges in Excel.
Use Names instead of Cell References
When you create Named Ranges in Excel, you can use these names instead of the cell references.
For example, you can use =SUM(SALES) instead of =SUM(C2:C11) for the above data set.
Have a look at ṭhe formulas listed below. Instead of using cell references, I have used the Named Ranges.
- Number of sales with value more than 500: =COUNTIF(Sales,”>500″)
- Sum of all the sales done by Tom: =SUMIF(SalesRep,”Tom”,Sales)
- Commission earned by Joe (sales by Joe multiplied by commission percentage):
=SUMIF(SalesRep,”Joe”,Sales)*Commission
You would agree that these formulas are easy to create and easy to understand (especially when you share it with someone else or revisit it yourself.
No Need to Go Back to the Dataset to Select Cells
Another significant benefit of using Named Ranges in Excel is that you don’t need to go back and select the cell ranges.
You can just type a couple of alphabets of that named range and Excel will show the matching named ranges (as shown below):
Named Ranges Make Formulas Dynamic
By using Named Ranges in Excel, you can make Excel formulas dynamic.
For example, in the case of sales commission, instead of using the value 2.5%, you can use the Named Range.
Now, if your company later decides to increase the commission to 3%, you can simply update the Named Range, and all the calculation would automatically update to reflect the new commission.
How to Create Named Ranges in Excel
Here are three ways to create Named Ranges in Excel:
Method #1 – Using Define Name
Here are the steps to create Named Ranges in Excel using Define Name:
This will create a Named Range SALESREP.
Method #2: Using the Name Box
- Select the range for which you want to create a name (do not select headers).
- Go to the Name Box on the left of Formula bar and Type the name of the with which you want to create the Named Range.
- Note that the Name created here will be available for the entire Workbook. If you wish to restrict it to a worksheet, use Method 1.
Method #3: Using Create From Selection Option
This is the recommended way when you have data in tabular form, and you want to create named range for each column/row.
For example, in the dataset below, if you want to quickly create three named ranges (Date, Sales_Rep, and Sales), then you can use the method shown below.
Here are the steps to quickly create named ranges from a dataset:
This will create three Named Ranges – Date, Sales_Rep, and Sales.
Note that it automatically picks up names from the headers. If there are any space between words, it inserts an underscore (as you can’t have spaces in named ranges).
Naming Convention for Named Ranges in Excel
There are certain naming rules you need to know while creating Named Ranges in Excel:
- The first character of a Named Range should be a letter and underscore character(_), or a backslash(). If it’s anything else, it will show an error. The remaining characters can be letters, numbers, special characters, period, or underscore.
- You can not use names that also represent cell references in Excel. For example, you can’t use AB1 as it is also a cell reference.
- You can’t use spaces while creating named ranges. For example, you can’t have Sales Rep as a named range. If you want to combine two words and create a Named Range, use an underscore, period or uppercase characters to create it. For example, you can have Sales_Rep, SalesRep, or SalesRep.
- While creating named ranges, Excel treats uppercase and lowercase the same way. For example, if you create a named range SALES, then you will not be able to create another named range such as ‘sales’ or ‘Sales’.
- A Named Range can be up to 255 characters long.
Too Many Named Ranges in Excel? Don’t Worry
Sometimes in large data sets and complex models, you may end up creating a lot of Named Ranges in Excel.
What if you don’t remember the name of the Named Range you created?
Don’t worry – here are some useful tips.
Getting the Names of All the Named Ranges
Here are the steps to get a list of all the named ranges you created:
This will give you a list of all the Named Ranges in that workbook. To use a named range (in formulas or a cell), double click on it.
Displaying the Matching Named Ranges
- If you have some idea about the Name, type a few initial characters, and Excel will show a drop down of the matching names.
How to Edit Named Ranges in Excel
If you have already created a Named Range, you can edit it using the following steps:
Useful Named Range Shortcuts (the Power of F3)
Here are some useful keyboard shortcuts that will come handy when you are working with Named Ranges in Excel:
- To get a list of all the Named Ranges and pasting it in Formula: F3
- To create new name using Name Manager Dialogue Box: Control + F3
- To create Named Ranges from Selection: Control + Shift + F3
Creating Dynamic Named Ranges in Excel
So far in this tutorial, we have created static Named Ranges.
This means that these Named Ranges would always refer to the same dataset.
For example, if A1:A10 has been named as ‘Sales’, it would always refer to A1:A10.
If you add more sales data, then you would have to manually go and update the reference in the named range.
In the world of ever-expanding data sets, this may end up taking up a lot of your time. Every time you get new data, you may have to update the Named Ranges in Excel.
To tackle this issue, we can create Dynamic Named Ranges in Excel that would automatically account for additional data and include it in the existing Named Range.
For example, For example, if I add two additional sales data points, a dynamic named range would automatically refer to A1:A12.
This kind of Dynamic Named Range can be created by using Excel INDEX function. Instead of specifying the cell references while creating the Named Range, we specify the formula. The formula automatically updated when the data is added or deleted.
Let’s see how to create Dynamic Named Ranges in Excel.
Suppose we have the sales data in cell A2:A11.
Here are the steps to create Dynamic Named Ranges in Excel:
-
- Go to the Formula tab and click on Define Name.
- In the New Name dialogue box type the following:
- Name: Sales
- Scope: Workbook
- Refers to: =$A$2:INDEX($A$2:$A$100,COUNTIF($A$2:$A$100,”<>”&””))
- Click OK.
Done!
You now have a dynamic named range with the name ‘Sales’. This would automatically update whenever you add data to it or remove data from it.
How does Dynamic Named Ranges Work?
To explain how this work, you need to know a bit more about Excel INDEX function.
Most people use INDEX to return a value from a list based on the row and column number.
But the INDEX function also has another side to it.
It can be used to return a cell reference when it is used as a part of a cell reference.
For example, here is the formula that we have used to create a dynamic named range:
=$A$2:INDEX($A$2:$A$100,COUNTIF($A$2:$A$100,"<>"&""))
INDEX($A$2:$A$100,COUNTIF($A$2:$A$100,”<>”&””) –> This part of the formula is expected to return a value (which would be the 10th value from the list, considering there are ten items).
However, when used in front of a reference (=$A$2:INDEX($A$2:$A$100,COUNTIF($A$2:$A$100,”<>”&””))) it returns the reference to the cell instead of the value.
Hence, here it returns =$A$2:$A$11
If we add two additional values to the sales column, it would then return =$A$2:$A$13
When you add new data to the list, Excel COUNTIF function returns the number of non-blank cells in the data. This number is used by the INDEX function to fetch the cell reference of the last item in the list.
Note:
- This would only work if there are no blank cells in the data.
- In the example taken above, I have assigned a large number of cells (A2:A100) for the Named Range formula. You can adjust this based on your data set.
You can also use OFFSET function to create a Dynamic Named Ranges in Excel, however, since OFFSET function is volatile, it may lead a slow Excel workbook. INDEX, on the other hand, is semi-volatile, which makes it a better choice to create Dynamic Named Ranges in Excel.
You may also like the following Excel resources:
- Free Excel Templates.
- Free Online Excel Training (7-Part Online Video Course).
- Useful Excel Macro Code Examples.
- 10 Advanced Excel VLOOKUP Examples.
- Creating a Drop Down List in Excel.
- Creating a Named Range in Google Sheets.
- How to Reference Another Sheet or Workbook in Excel
- How to Delete Named Range in Excel?
Names are one convenient identity. Imagine how we’d be addressed if we didn’t have names? Excel tries to make our lives easier by providing us with a similar convenience.
Excel’s Names feature can be surprisingly powerful for organizing data in Excel. Named Ranges let you name a group of cells and then refer to them as a unit as if they were a single cell.
Using named ranges can make formulas easier to read and understand and provides simple navigation via the Name Box. Named ranges are easy to create and can be used for a variety of purposes.
This tutorial will teach you how to use Names feature in Excel.
What are Named Ranges
In Excel, a cell or a range of cells can be named to make their usage easier. It would be simpler to use a named range directly in a formula or select said range.
You can name:
- a Range of cells,
- a Formula,
- a Constant or
- a Table
Benefits of Creating Named Ranges in Excel
- The prime advantage of named ranges is the ease they provide. You don’t have to keep glancing at certain cells or tables to pick up values or cell references and can use a named range instead.
- Using a named range will save typos that may otherwise occur while typing values or formulas since entering named ranges is a clickable option.
- They are of great help to use in formulas as the named range appears upon typing the first letter of the name.
- Named ranges make formulas movable and they can be used from sheet to sheet and workbook to workbook.
- A dynamic named range can automatically account for expanding and contracting data (when values are added or deleted from a dataset) without having to change the formula or recalculate.
- A named range can be used for data validation (creating drop-down menus) without much hassle.
- Hyperlinks can quickly be created from existing named ranges.
- Named ranges make navigation and directing very easy. You can click on a named range in the Name Box and arrive at the named range.
- For all the above benefits that named ranges deliver, they are very simple and quick to create.
Rules for naming Named Ranges
There are several pointers not to trespass while creating named ranges:
- A name should have less than 255 characters.
- A name should not have space and punctuation characters (exceptions mentioned as follows).
- A name’s first character has to be a letter, an underscore ( _ ), or a backslash ( ).
- A name may contain a question mark but never as a first character.
- A name is not case-sensitive. (sale, Sale, and SALE are treated as one name).
- A name must not resemble a cell reference (e.g., A1, A$1).
- A name may be a single letter name but must not be r, R, c, or C as «R» and «C» signify row and column selection shortcuts.
How to Create Named Ranges in Excel
There are two methods to create named ranges in excel. We will see both these methods in this section.
Let’s say we have the data as shown below and we want to create two named ranges – one for the History marks and the second one for the Geography marks.
We will create these two named ranges using two different methods to help you get a hang of both methods.
Method 1 – Creating Named Ranges from the Name Box
The how-to here is pretty simple. Select the range, enter the desired name in the «name box» and press Enter. Done! Really! We can show you how easy this is with a visual.
Here’s how it’s done:
- For naming the History marks range, we will select the History marks i.e., range C3:C7.
- Click on the name box.
- Enter the desired name («History» in this case).
- Press the Enter key.
Method 2 – Creating Named Ranges from the ‘Define Name’ Option
Names can also be created from the «Define Name» button, in the formulas tab. To use this method follow the below steps:
- Select the range which you want to name, in our case it will be D3:D7.
- Navigate to the «Formulas Tab» and click the «Define Name» button.
- Now, in the «New Name» window enter the desired name for the named range.
- After entering the desired name click the «OK» button and it is done.
How to Edit Named Ranges in Excel
Suppose you accidentally missed a cell in the range or want to change the name of your named range. This means the named range needs to be edited.
Named ranges can be managed through the «Name Manager» which can be found under the «Formulas» tab > Name Manager or can be accessed through the keyboard shortcut Ctrl + F3.
This is what you will see when you open the Name Manager:
Here, you can see the named ranges in your sheet and their details. Double click the named range you wish to edit or select the named range and click the «Edit…» button.
Clicking on the «Edit…» button will open the «Edit Name» window where you can edit the name or the cell range of the named range. When done, click «OK» and then click the «Close» button on the Name Manager.
How to Delete Named Ranges
The Name Manager can also be used to delete named ranges. Click the named range you wish to remove, press the «Delete» button.
You will get a pop-up confirmation asking whether you want to delete the named range or not. Press «OK» and that will delete your chosen named range.
Note that the Name Manager also has a «Filter» button that can be used for filtering the names and only viewing the relevant names at a given time. It can be quite handy when you have a lot of names to deal with.
Recommended Reading: How to Lock and Protect Cells in Excel
How to Create Names from Cell Text
For batch information where the data is in the columnar or row format (i.e., in either columnar form with headings at the top and its relevant data below. Or in rows with headings on the left and its data on the right) there is a quicker way of naming ranges. We can use the «Create from Selection» feature in Excel to give the heading’s name to the range. Here is how:
So, we have the dataset containing marks scored by students in various subjects. The layout is in columnar form. We can use the «Create from Selection» feature in this case as –
- Select the range and the heading. We will select columns C, D, E, and F to name each range according to its heading.
- In the «Formulas» tab, click «Create from Selection» or use the keyboard shortcut Ctrl + Shift + F3. This is what you should see:
- According to the layout of your dataset, select the row or column where the headings need to be picked from. For our case, we will select the «Top row» option as headings. «Marks in History», «Marks in Geography», «Marks in Science», and «Marks in Math» are in the top row.
- After selecting the appropriate options click «OK».
Doing this has created multiple named ranges for our data. You can see from the drop-down in the Name Box that we have 4 named ranges created according to the headings of each column.
Note that the spaces in headings are replaced with underscores while creating the names.
Named Ranges with Hyperlinks
If you thought named ranges made you bounce around with ease through worksheets, wait for their synergy with hyperlinks. Named ranges make hyperlinking a smoother process as data required for hyperlinking would already be grouped and named. Let’s show you how this will work.
For the sake of this example let’s assume that we have another named range «Student» in Sheet2 as shown.
We will hyperlink the Student column from Sheet1 to direct us to the student range in Sheet2.
- Select the Student range in Sheet2 (i.e., B3:B7).
- Right-click the selected area and click on «Link». The «Insert Hyperlink» window is what you should see.
- We will select «Student» from «Defined Names» which we have already defined in Sheet2.
- Click «OK».
We have hyperlinked the Student Names to Sheet2 using the «Student» named range. Clicking on any of the marks should take us to the «Student» range on Sheet2. Let’s check.
Affirmative!
How to Create an Excel Name for a Constant
The Name Manager can also be used to create a name for a constant value. This constant value will not be a cell reference on the sheet but it can be used by its name in formulas.
For our example, we will use a named constant to calculate the percentage of the overall marks of each of 5 students. We start by accessing the Name Manager and applying for a new name.
The percentage will be calculated by dividing the sum of the attained marks by the total (each subject is marked out of 50. Which makes 50 x 4 = 200). We will set «200» as our named constant and give it the name «total».
Using «total», we can calculate the percentages without having to refer to «200».
Here, we have substituted «200» for «total» and calculated each student’s overall percentage.
How to Make a Named Formula
Taking the above example, what if we named the whole formula and get the same results? Sounds like a good bargain for smart input. Let’s see how to do that.
We first head to good old Name Manager and «New Name» again. We will name our formula «Percentage». The reference of this name is shown as
=SUM(Sheet2!$C3:$F3)/total
The range of the SUM in the formula is «C3:F3». The columns have been locked into absolute references by the $ sign. Notice that the rows have not been locked as absolute references so that the formula can be dragged to apply to all the rows.
Now just by using «Percentage», we can use the named formula to calculate the students’ percentages.
Named Ranges for Data Validation
Named ranges make the «Data Validation» feature in Excel a breeze. You can create a drop-down menu with values from a named range.
This comes with some advantages. You can simply refer to the named range in the Data Validation window instead of having to directly enter the cell ranges. It also gives a point of relevance to see the named range in sight. Let’s see how it’s done.
Let’s assume – we have a list of products and their prices and discounts. Our objective here is to calculate the discounted price for each product after entering its relevant discount. Instead of copy-pasting each discount, we want the option to select the discount from a drop-down menu for each cell in column D.
We will create a drop-down menu with the «Discount» named range (G3:G6).
- Select the cells for which you want to create the drop-downs (D3:D9 for our case).
- Under the «Data» tab, in the «Data Tools» section, select «Data Validation» dropdown and click the next «Data Validation» option.
- Inside the «Data Validation» window, under «Allow», choose «List» and enter the required named range under «Source». We will enter the reference of our «Discount» range here.
- Click «OK». This has very conveniently created drop-down menus for all cells D3:D9, taking values from the «Discount» named range.
- Now we can select the respective discounts and arrive at our «Price after discount».
See all Names Directly on the Worksheet
There is a small hack that allows you to see all the names directly on the worksheet. You can view all your named ranges (marked with the names) on the sheet if you zoom out to anything less than 40%. We’ll follow that religiously and zoom out at 39%.
The only thing amiss about this is that the named range text is like a watermark; it’s not opaque and will not work so well for small and narrow columns. This hack is suitable for data with a wide-set column or several more rows so the name of the range can be seen. Otherwise, it would be on the brink of being unnoticeable.
Scope of a Name
If you open the Name Manager and have a look at the named ranges, you will find that each named range has a scope (e.g., Sheet1, Sheet2, Workbook, etc.) against it.
Scope refers to the location, or level, within which the name is recognized. For instance, in the above image «range4» can only be used within Sheet1 whereas all the other names can be used across the entire workbook.
Based on this there can be 2 levels of scopes:
- Local worksheet scope
- Global workbook scope
Local Worksheet Scope
Locally scoped names can only be recognized and used on the sheet it is created upon. This implies that inside a single workbook we can have the same locally scoped names (each within a separate worksheet). For instance – you can have a yearly expense workbook with a worksheet for each month and then we can have a single locally scoped name within each worksheet.
Pro Tip: Named ranges made using the Name Box have global scope by default. However, you can tie the named range down to a sheet (in other words, make it locally scoped) simply by using the sheet’s name before the range’s name (with an exclamation mark).
Sheet1!Expenses
Global Workbook scope
Globally scoped names can be recognized and used across the whole workbook. Global names must always be unique within the workbook. For instance – we can create a global name to define the value of a constant like pi (as 3.14) and use it across the whole workbook.
Creating Dynamic Named Ranges in Excel
Up until now with all the examples above, we can say that if we were to expand on the data by adding more values, the formulas already applied wouldn’t account for the new values. This means that whenever values will be added to the dataset of the named range (e.g., B2:B15) which expands the dataset to B2:B20, the named range will still not account for the additional 5 values and remain a named range for B2:B15. This means the named range is static as opposed to a dynamic named range. The additional step that would need to be taken to fix this is to edit the named range and modify the range mentioned.
A dynamic named range on the contrary will itself adjust for changes in the range. To make our named range dynamic, we will add a function to the reference of the named range. If this sounds too complicated, let us show you how it’s done.
There are a couple of ways of creating a dynamic named range. One of them is using the OFFSET function. The drawback is however that OFFSET is a volatile function; with each and every change in a worksheet, OFFSET recalculates. This is not an issue for an uncomplicated worksheet with small datasets. But with complex and large worksheets, you will find that OFFSET slows things down. In such a case, the other way to create a dynamic named range is using the INDEX function.
So if you can use OFFSET for small datasets and INDEX for large ones, why not just master the INDEX function and use that? So this use of the INDEX function for dynamic named ranges is what we’ll be tapping into right now. Let’s see an example:
Taking simple sales data, we will add a dynamic named range that we will later use to calculate the total sales:
- Open the «Name Manager» > click the «New Name» option.
- Set the desired name (we are naming our named range «Sales»).
- In «Refers to», feed the following formula, and click «OK».
=$C$3:INDEX($C$3:$C$1048576,COUNTIF($C$3:$C$1048576,"<>"&" "))
We have used the SUM function to total the named range «Sales». It has given us a total of «3186» which is also confirmed from selecting the cells with the results displayed in the status bar below.
Now let’s add some values to this dataset to see if the formula applied complies with changes in the data.
We have added new sales data and the named range has updated itself because of the formula we have put in to build the range. So how does this formula work?
Let’s see the formula again:
=$C$3:INDEX($C$3:$C$1048576,COUNTIF($C$3:$C$1048576,"<>"&" "))
Since we’re using the INDEX function in the formula, let’s get familiar with it. The INDEX function returns a value or cell reference of a particular cell in a given range. The part we need to work with right now is the return of a cell reference.
The COUNTIF function counts the number of cells within a range that meets the given condition. The range given to COUNTIF is C3:C1048576. COUNTIF needs to look through the entire C column ahead of C3 (if you press Ctrl + down key, you will find the last row given in Excel which is row number 1048576. That is why we have used C1048576 in our formula. According to how big or small your data is, you can refer to any row ahead of your last value, suppose 100 rows ahead of your last value. In this way the formula will account for all changes made up to the last-mentioned row).
The condition given to COUNTIF is counting the number of cells from C3 to C1048576 that should not be equal to (defined by «<>») blank cells (defined by » «). Take note that this will work only if the data does not consist of blank cells as the blank cells are the ones to be ignored by the function.
According to this condition, the non-blank cells that COUNTIF was able to find from the given range were C3:C9. Passing this result to the INDEX function, INDEX then returns the value of the last item of the list (which would be C9’s value i.e., 404). The formula starts with the first cell that we need to include in our named range (i.e. C3, fed as an absolute reference by «$» signs). Using this reference before the INDEX function makes INDEX return the cell reference instead of the value which will then be C9.
The result of the whole formula has worked like this:
Note: Dynamic named ranges aren’t shown in the Name Box. Use the Name Manager to see all named ranges (static and dynamic).
Named Range Shortcuts
The more matters are sitting on your fingertips, the better. To wrap things up, here are some useful keyboard shortcuts with named ranges that should move you around the sheet even faster.
- F3 – Pops up a «Paste Name» dialogue box for pasting a named range from the full list of named ranges.
- Ctrl + F3 – Opens «Name Manager»
- Ctrl + alt + F3 – Pops up «New Name» dialog box for creating a new named range.
- Ctrl + shift + F3 – Pops up «Create Names from Selection» dialog box for creating named ranges from headings/titles.
- F5 – Pops up the «Go To» dialog box for navigating to the chosen named range from the full list of named ranges.
With that, we’ve discussed the ins and outs of the Named Ranges in Excel. They are simple, but extremely useful while working with larger datasets and multiple ranges. While you solidify your expertise with some practice, we’ll have another awesome tutorial ready for you ready!
Excel Named Range (Table of Contents)
- Named Range in Excel
- Define Names from a Selected Range
- How to Create a Named Range in Excel?
Introduction to Named Range in Excel
Named Range just makes the process of working with formulas exciting, especially to keep track of things. It is just very convenient to assign a name to a range. If there is any change in that range, it becomes infinitely easier to update the range through the Name Manager. It totally allows us to bypass the process of manually updating every formula. Also, in cases of nested formulas, where one formula has to be used in another formula or maybe just used in a different location, all that needs to be done is to refer to the formula by its name.
The importance of named ranges is that one can use any names in the formula without worrying about the cell addresses/references. Any name can be assigned to a range. Any named constant or any data can be given a named range, and these names can be used instead of the actual formula. In this way, it becomes easier to understand the formulas. So, what this does is that it gives a range of cells in Excel a human-understandable name. By making use of named ranges, one can make the usage of formulas straightforward in Excel. One can give a name to a range in a formula or function, a constant, or a table. After starting to use names in a sheet, one can easily comprehend these names.
Define Names from a Selected Range
Firstly, one has to select the range that you want to give a name. Thereafter navigate to Formulas and then select Create from Selection.
From the “Create Names from Selection” box, select either Bottom Row, Top Row, Left Column, or Right Column, and then click on OK.
The cells are named based on labels in the designated range:
- First, use names in formulas and then focus on a cell and then enter a formula.
- The cursor has to be placed at the location where we want to use the named range in a formula.
- The name can be selected from the list that opens up after typing the name’s first letter.
- Alternatively, navigate to Formulas and then Use in Formula, followed by selecting the name that you intend to use.
- Press Enter.
It is also possible to update the named ranges from the Name Manager. The shortcut to update the named ranges from the Name Manager is Ctrl+F3. We just need to select the name that we wish to change and then proceed to change the reference directly.
How to Create Named Ranges in Excel?
Let us understand the concept of the Named Range through some examples.
You can download this Named Range Excel Template here – Named Range Excel Template
Example #1
Create a Named Range by using the Define Name option
- First, focus on the cells by selecting the range of cells.
- Now, navigate to the Formulas tab. Next, go to the Defined Name group. Click to select Define Name.
- Now once the New Name dialog box opens, mention three things -Name, Scope, Comment.
- Now in the “Name:” category, provide a name for the range.
- Now in the “Scope:” category, from the dropdown, the name scope has to be set (by default, it is Workbook)
- Now move on to the ‘Refers to:’ section, verify the available reference, and modify it if required. After that, click on OK to save the changes you have made and close the dialog box.
Example #2
Create a Named Range by utilizing the Name Manager
- Navigate to the Formulas tab and then proceed towards Define Name Group and then click on Name Manager.
- Alternatively, you can also press Ctrl+F3, which is the shortcut for the same.
- Now, on the top, towards the Name Manager’s left corner, we have the ‘New’ button. Click on it.
Then the New Name dialog box will open.
Example #3
Create a Named Range using VBA
We can also create a Named Range in VBA.
So, this is what we did in the code snippet above:
- We created three variables – myWorksheet of Worksheet datatype, which will store the name of the Excel Worksheet, myNamedRange of Range datatype, which will hold the name of the range of cells that we wish to name, and myRangeName, of String datatype, which will hold the name of the Named Range.
- We defined our Worksheet (in the variable myWorksheet).
- We then went on to define the range of cells that we wanted to name (in the variable myNamedRange).
- After that, we defined the name of our Named Range in the variable myRangeName.
- After that, we proceed to create the Named Range and provide the reference to which it will point to.
This concludes the Named Range creation process through VBA.
Things to Remember
The following things must always be kept in mind while creating or dealing with Named Ranges in Excel.
- Named Ranges can have names that start with either a backslash (), letter, or underscore (_). Numbers or other special symbols are invalid as the starting character. If any other character other than letters, backslash or an underscore is given as the starting character, then Excel will throw an error.
- There is also a limitation on how long the name of a Named Range can be. The maximum length of a name can be 255 characters. Anything above 255 characters will cause Excel to throw an error.
- Every name has to be a continuous sequence of characters. There is no scope to have spaces, tabs, or any punctuation marks in the name. This is done so as to maintain uniformity and make the names easier.
- Another important instruction while working with Named Ranges is that a Named Range’s name must not have any conflict with cell references.
- As we saw, there is a limit on the maximum length for a name. Conversely, a name must also be of at least one character length at a minimum. Names are allowed to be of a single character length; however, there are few characters such as ‘r’ and ‘c’, which are reserved by Excel and can not be used as Names.
- As a bonus, Names aren’t case sensitive, which means that names such as “Jon”, “JON”, “jon” are all the same to Excel.
Recommended Articles
This has been a guide to Named Range in Excel. Here we discussed how to create a named range in excel along with practical examples and a downloadable excel template. You can also go through our other suggested articles to learn more –
- Excel Function for Range
- Range in Excel
- VBA Named Range
- VBA Range
Users of all levels have different feelings about Excel named ranges. Some find them cumbersome, while others use them religiously.
In addition to allowing quick access to complex references, named ranges can make your formulas a lot easier to read and maintain. Once you make the habit of using named ranges in your Excel workbooks, you’re going to feel the difference in how quickly you can work and manage your data.
In this article, we’re going to cover the basics, advanced features, and various ways of how Excel named ranges can make life easier. We’re going to be using different examples for each feature. Please feel free to download our sample workbook below.
What is a Named range?
Named ranges are cells, ranges, tables, formulas, or constant values that are represented with meaningful names, besides their workbook reference (i.e. A1, B23, A1:B23). Using named ranges make formulas easier to read and maintain.
Let’s take an example. Here we have a formula using INDEX function that looks up a value.
=INDEX(B3:E11,MATCH(I3,C3:C11,0),4)
Using named ranges, this formula would look like below.
=INDEX(sales_data,MATCH(current_date,dates,0),amount_column)
The second example is easier to interpret as you don’t need to go back to that specific reference and identify what these cell references are.
Creating Named Ranges
There are several ways to create Excel named ranges. The easiest method is selecting the cell range, and then typing in the name of your named range into the reference box (right before the formula box on the top bar).
Please note that there are certain limitations for what names you can use as a named range. Consider the items below when creating named ranges.
- The first character of a name must be a letter, an underscore character ( _ ), or a backslash ( ).
- The subsequent characters in the name can be letters, numbers, periods, and underscore characters.
Note: Although you can create names that consist of a single letter, such as «a», «e» or «j»; you cannot use the uppercase and lowercase characters separately (i.e. «C», «c», «R», or «r»).
- Names cannot be the same as a cell reference (i.e. Z$100 or R1C1).
- You can’t use a space.
- A name can contain up to 255 characters.
- Names are NOT case sensitive. According to Excel «data», «Data» and «DATA» are the same.
Another way to create a named range is by going into the Define Name menu from the FORMULAS tab in the ribbon. First select your cell, then go to this menu and type in the desired name into Name box and click OK to apply.
Note: The same New Name dialog will pop up if you click the New… button in the Name Manager window. Follow these steps to create a name using the Name Manager:
- Go to the FORMULAS tab in the ribbon
- Click Name Manager
- In the Name Manager window, click the New… button
If you want to add several named ranges in one go, go to Create Names from Selection. This feature allows you to add name ranges using the labels adjacent to your ranges. To do this:
- Select your data
- Go to the FORMULAS tab in the ribbon
- Click Create Names from Selection
- Select options that applies to your data. For example, selecting Top row and Left column options will give 5 named ranges in our example:
- Inputs =B2:B5
- First_Name =B2
- Last_Name =B3
- Age =B4
- Occupation =B5
- Click OK to add named ranges
Note: If the labels next to selected cells do not meet the limitations mentioned before, Excel automatically removes unsupported characters and replaces them with underscore characters ( _ ). As a result, «First Name» in this example was registered as «First_Name».
Use Cases
References
Named ranges are typically used for giving meaningful names to cell and ranges. You can use those names like regular references without having to use the actual cell range references.
sales_data = B3:E11
current_date = I3
dates = C3:C11
Constants
Just like cell and range references, constant values can also be used as named ranges. Instead of entering a commonly used value every time, entering a name instead can be easier and make your formulas easier to understand.
To save a constant value as a named range you need to use the Name Manager. In Name Manager window, click the New… button, and type in the value after an equal sign into the Refers to: panel.
Formulas
Formulas can also be given named ranges. You can create a named range from a formula the same way you would with constant values using the Name Manager.
Entering your formula after an equal sign in the Refers to section will save this entire formula as a name.
This ability shines especially when creating dynamic ranges that can grow or shrink automatically based on workbook data. For example, =OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A),1) formula in this example returns an array of values and excludes spaces, when you enter data into column A. With this formula, you can create dynamic dropdown lists or dynamic charts without unnecessary spaces. Using a named range instead is certainly faster than using the entire formula. For more information about dynamic charts check out our Excel’s Dynamic Charts: A Tutorial On How To Make Life Easier article.
Tables
When you add a Table, more accurately, when you convert your data into a Table, Excel automatically adds a Named Range that refers to that table. Although table names are listed in Name Manager, they differ from regular Excel Named Ranges – You can’t edit the reference range or delete it from the Name Manager window. Table named ranges are also shown with a different icon than named ranges.
Table named ranges are dynamic by default, so they can grow and shrink as you add or remove data. To add a table and use this functionality, just select your data and press Ctrl + T and follow the steps.
Other Advantages
Names in formulas list
Named Ranges are automatically listed in the formulas list when you start typing.
Even if you have long named ranges, you can select them quickly for using them in formulas. Pressing the Tab key will add it to your formula automatically.
Call a name from name list
There is an alternative to using named ranges in formulas method which allows you to see only named ranges in a separate list and add them to your formula. While typing in a formula, press the F3 key to bring up the Paste Name list.
Select the named range and click OK to add it.
Copy formulas between workbooks and worksheets
Excel named ranges make working between several workbooks and worksheets a breeze. For example, if you have similar workbooks that cover user input data from different years, you might want to use similar formulas with different range references. When applying the formulas from one worksheet to another, you need to update the formula ranges manually. However, if you use names instead of references and use the same names for similar data, the copying process will be much easier as formula syntax will remain the same between workbooks.
The same approach can be used between worksheets as well. However, in this case, named range scopes should be selected as “worksheets”, instead of “workbook”. We will cover named range scopes later in this article.
Navigation
Named Ranges are useful for fast navigation. All named ranges are listed in the dropdown menu under the reference box. Clicking a name will automatically move your focus to the named range.
Named ranges are also listed in the Go To window. Press F5 to open the Go To window and double click the name you want to go to.
Named can be used as hyperlinks
Named Ranges will appear in the Insert Hyperlink window. To add a hyperlink;
- Right-click the cell
- Click Hyperlink from the menu
- In the Hyperlink window, click Place in This Document
- Select the name you want to link and click OK
An alternative way to create hyperlinks is to use the HYPERLINK function. You can use Named Ranges in HYPERLINK function by placing a hash character (#) before the name.
=HYPERLINK(«#State»,»Go to State List»)
Dynamic Ranges via tables
We’ve already learned that dynamic ranges can be created using formulas and a Named Range. An alternative way to do this is by using a Table reference inside a Named Range. We’ve mentioned that table named ranges are dynamic and can automatically grow or shrink, and we will be using this feature to do the same for a single named range.
Tables have their own reference syntax. Table name comes first and column name follows, inside brackets. For example, «Table1[State]» refers to column name «State» in «Table1». Because this table is dynamic, its columns will be dynamic as well. The trick is creating a Named Range that refers to a table reference, instead of a single range reference or a formula.
«States» named range is now a dynamic range too.
Zoom out to see Excel Named Ranges
If you have data that spans over dozens of rows and/or columns, giving those tables named ranges and zooming out can help visualize the big picture. Excel starts showing names when the zoom level is below 40%.
Scope
Named Ranges can be defined under workbooks or worksheets. This is the scope of the named range. Scope of named ranges are Workbook by default.
‘Workbook’ scope means you can access the specified named range from all sheets and it always refers to the same value, formula, or reference.
On the other hand, if a named range’s scope is set to ‘worksheet’, that name works inside that specific worksheet. This feature is useful when you have same kind of data across different worksheets. Excel allows giving the same name into multiple ranges as long as they are not under overlapping scopes. The example below contains 3 named ranges, all of which are named «data».
=SUM(data) formula returns 3 different values when the formula is used in each sheet (i.e. Sheet2, Sheet3, Sheet4).
- In Sheet2, =SUM(data) returns 10
- In Sheet3, =SUM(data) returns 110
- In Sheet4, =SUM(data) returns 1110
To call a local scoped named range from different worksheet, you need to use the parent worksheet name as well. For example:
- In Sheet2, =SUM(Sheet2!data) returns 10
- In Sheet3, =SUM(Sheet2!data) returns 10
- In Sheet4, =SUM(Sheet2!data) returns 10
You can determine the scope of a named range when you add it. You need to use Define Name menu or the Name Manager to add a local scoped named range. In the New Name menu, choose a worksheet under the Scope dropdown.
Please note that you can’t change this afterwards. The only way to do this by deleting the named range and create it again.
How to manage and delete Excel Named Ranges
The Name Manager window is like the base of operations for Named Ranges. Here, you can find a list of all named ranges, add/edit/delete them.
Deleting Named Ranges
To delete name ranges, first select names you want to delete, and then click the Delete button. You can use Ctrl and Shift keys to select multiple names and delete them with one click.
Filtering and sorting names
Name Manager allows sorting and filtering names. You can sort names by clicking the columns for Name, Value, Refers To, Scope or Comment.
Multiple filters can be applied from the Filter dropdown.
Additional Features
Apply Names
If you create named ranges after creating your formulas, the formulas will keep using regular references if you do not update them. To update formulas, you have 2 options:
- Changing references using the Find & Replace
- Using Apply Names feature
For the first method, open the Find & Replace dialog (i.e. Ctrl + F), then enter reference and named range. Click the Replace All button to replace all occurrences.
The second method is a bit easier and, in some cases, safer than Find & Replace because you don’t need to enter a reference. To use Apply Names, click the down arrow next to the Define Name under FORMULAS tab and go to Apply Names. This will bring up the Apply Names window with a list of names. Select the names you want to update and click OK to convert ranges into names automatically.
Paste List
You can open the Paste Name dialog by pressing the F3 key on your keyboard, or find it under the Use in Formula dropdown in the FORMULAS ribbon.
In the Paste Name dialog box, clicking Paste List button creates a list of existing names in the active worksheet.
Please note that table names and local names that are not under the active sheet scope are not listed here.