David wonders if there is a way he can make a formula not automatically update when he inserts a column that would otherwise affect the formula. For instance, if he has the formula =SUM(B:B) and then he inserts a column to the left of column B, the formula is automatically updated by Excel to =SUM(C:C). He doesn't want the formula to update; he still wants it to refer to column B after he inserts the new column.
One way to get the result you want is to use the OFFSET function to refer to column B. For instance, consider the following formula:
=SUM(OFFSET(A:A,0,1))
If this formula is in a cell, and you insert a column before column B, then the formula doesn't update; it still refers to column B. Why? Because the formula refers to column A and you didn't do anything to move column A. If you did insert a column before column A, then the formula would update to reference column B.
This means that the best way to handle the formula is to use the INDIRECT function, in this manner:
=SUM(INDIRECT("B:B"))
The INDIRECT function uses text for a parameter, and since it is text it is not considered a reference to be updated by Excel. Regardless of inserting or deleting columns, the formula will always refer to column B.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10786) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Stopping a Formula from Updating References.
Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!
Creating math formulas is a particular strong point of Excel. Not all the functions that you may need are built directly ...
Discover MoreReplacing one character in a text value with another character is easy. All you need to do is use the SUBSTITUTE ...
Discover MoreExcel provides worksheet functions that make it easy to count things. What if you want to count records that match more ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2018-11-05 18:31:17
Mark
Use of volatile functions like OFFSET and INDIRECT could slow recalculation times if applied to a large number of cells because they are recalculated every time recalculation is invoked.
2015-02-16 11:03:36
As Barry, I recommend using named ranges to INDIRECT.
INDIRECT (OFFSET too) is volatile, meaning that it will recalculate whenever ANY cell in the workbook is modified, instead of just recalculating when a cell in its formula is modified. For big files, this can slow things down.
2015-02-14 06:01:21
Barry
Another way is to use Named formulas, which are useful when copying the formula.
You have to bear in mind and be careful that cell references are in effect considered to be relative to the cell selected when the formula is created.
For example with cell A2 selected create a formula called "OneAbove" with a value =A1. Entering "=OneAbove" (without quotation marks) will return the content in the cell immediately above it (except if in row 1). This will always be the case even if you insert a row immediately above the cell containing the formula.
This can be overridden by prefixing the row and/or column reference with a "$". This the exact opposite to the way in which absolute/relative references normally work in an ordinary formula.
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 © 2021 Sharon Parq Associates, Inc.
Comments