Written by Allen Wyatt (last updated April 26, 2025)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365
Bud has 50 or 60 defined names in a workbook. In a lot of these names, he needs to change any occurrence of $Q$4 to $Q$3. Bud can pull these up in the Name Manager and edit them individually, but he's wondering if there is a way to do it in a less manual manner.
There are two ways you can approach this issue. The first is to try to "cheat" and have Excel do the changing. Select the current cell Q3 and then delete that cell, moving the cells upwards. That will move the current Q4 to Q3, and Excel should update all references (including any defined names) to now reference Q3.
Of course, this won't work if making the deletion messes up the layout of your worksheet. In that case, you would be better served to use the second approach, relying on a macro. The macro can easily step through each of the defined names and make the replacement. Here's a very simple example:
Sub ReplaceFormulasInNames() Dim n As Integer For n = 1 To Names.Count Names(n).RefersTo = Replace(Names(n).RefersTo, "$Q$4", "$Q$3") Next End Sub
The macro examines the RefersTo property for each name and, if it contains the text $Q$4 it is changed to $Q$3.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13654) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365.
Dive Deep into Macros! Make Excel do things you thought were impossible, discover techniques you won't find anywhere else, and create powerful automated reports. Bill Jelen and Tracy Syrstad help you instantly visualize information to make it actionable. You’ll find step-by-step instructions, real-world case studies, and 50 workbooks packed with examples and solutions. Check out Microsoft Excel 2019 VBA and Macros today!
Is your worksheet, imported from an external source, plagued by non-printing characters that show up like small boxes ...
Discover MoreEach cell in a worksheet can hold quite a bit of information. If you want to see the information in the cell without the ...
Discover MoreIf you need to swap the contents of two cells in your worksheet, Excel provides a number of ways you can approach the ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2025-04-26 12:49:12
J. Woolley
My Excel Toolbox includes the following dynamic array function to list defined names with workbook, worksheet, or any scope, including names that are normally hidden:
    =ListNames([Scope], [SkipHidden], [SkipHeader])
The list includes the following columns: Scope, Name, Visible, Refers To, Value, and Comment.
The NamesInFormulas macro in My Excel Toolbox lists hyperlinks to formula cells referencing each visible defined name (named range) in the active workbook; hidden names are ignored. The cell's formula is included in a comment attached to its hyperlink. The following details are also provided for each name: Scope, Name, Refers To, Value, and Comment. Results are recorded in the active workbook's 'NamesIn...' worksheet.
https://sites.google.com/view/MyExcelToolbox/
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments