Written by Allen Wyatt (last updated November 30, 2024)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021
Judi has a question about using a static cell reference in a formula. She has a formula that refers to cell U3, and wants it to always refer to cell U3. If she inserts or deletes columns between the cell containing her formula and cell U3, she doesn't want the formula to be updated with a new column reference; she wants it to always refer to cell U3. Referring in the formula to $U$3 doesn't work because it is updated by Excel when columns are inserted or deleted.
Judi is correct—as you add rows and columns to your worksheet, Excel will routinely update the addresses used in formulas. As an example, let's say that you want to reference cell U3, so you use one of the following very simple formulas:
=U3 =$U$3
If you then delete column M and look at the cell containing the formulas, they will have changed to one of these:
=T3 =$T$3
Even if you select U3 and assign the range a name, when you later delete a column, the cell originally referenced by the name will move to reflect the deletion.
The solution to this is to use the INDIRECT function. For instance, anyplace you want to reference cell U3, you would use this:
=INDIRECT("U3")
The function returns the contents of cell U3, regardless of how many edits you do after creating the formula. This occurs because Excel considers the parameter to be a string, not a cell address. Therefore, it won't change the string contents if you later delete or insert columns. If need be, you can also include the sheet name in your string:
=INDIRECT("Sheet1!U3")
Just a moment ago I said that you could not create a named range for cell U3, because the range that the name refers to is updated as you add or remove rows or columns. However, you can create a name to refer to something other than a range—the name can refer to a formula. So, for instance, you could use the Name Manager and create a name (such as MyRef) that refers to the simple INDIRECT formula mentioned:
=INDIRECT("U3")
Now you can use the name (MyRef) within your formulas, and the name will always refer to the contents of cell U3, regardless of how you add or remove rows and columns.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13942) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
Need to find out how many times a certain letter appears in a text string? It's easy to do if you rely on the SUBSTITUTE ...
Discover MoreWant to know how to move pieces of information contained in one cell into individual cells? This option exists if using ...
Discover MoreIf you have a special need to find cell values that meet two different criteria, where to start can be daunting. This tip ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments