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.
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!
For some operations and functions, Excel allows you to use wild card characters. One such character is an asterisk. What ...
Discover MoreAdding row numbers to a column of your worksheet is easy; you just need to use a formula to do it. Here's a quick look at ...
Discover MoreLooking for a formula that can return the address of a cell containing a text string? Look no further; the solution is in ...
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 © 2019 Sharon Parq Associates, Inc.
Comments