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.
Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!
Excel includes a built-in tool that will remove duplicate rows from a worksheet. If you want to remove non-duplicate ...
Discover MoreExcel can be used as a simple database program. If you use asterisks in a column of your database to designate ranking of ...
Discover MoreWant to be able to take information that is in one cell and match it to data that is contained in a table within a ...
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