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.
Best-Selling VBA Tutorial for Beginners Take your Excel knowledge to the next level. With a little background in VBA programming, you can go well beyond basic spreadsheets and functions. Use macros to reduce errors, save time, and integrate with other Microsoft applications. Fully updated for the latest version of Office 365. Check out Microsoft 365 Excel VBA Programming For Dummies today!
Excel allows you to edit the contents of a cell in two places--"the cell itself or in the Formula bar. If you want to ...
Discover MoreReferring to a range of cells on the current worksheet is easy. But what if you want to refer to a range on a number of ...
Discover MoreDo you need to change whether a particular reference in a formula uses a relative or absolute reference? If so, you may ...
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