by Allen Wyatt
(last updated August 14, 2017)
Adam has two formulas in cells A1 and A2. In A1 he has the formula =B150 and in cell A2 he has the formula =B149. He tried to copy this sequence downward, using the fill handle, but the sequence wouldn't work right. (For instance, after filling cell A3 contained =B152 when it should have contained =B148.) Adam wonders if there is a way to have such a fill work properly.
Adam is right; filling will not work in this instance. The reason is because the fill feature in Excel works with values, not with formulas. So, there are a couple of ways you can approach this problem.
The first is to place text values of some sort into cells A1 and A2. For instance, you could place the text "x=B150" (without the quotes) into cell A1 and "x=B149" (again, without the quotes) into cell A2. Excel rightfully parses these cells as text. You can then select A1:A2 and drag downward as far as you need. Excel follows the pattern in the text (remember, it isn't a formula) and decreases the numbers. (Don't drag past cell A150. When you hit A151 the text will be "x=B0" and then Excel starts counting upwards again in cell A152.)
Now, select all the cells that you just filled and use Find and Replace to search for the preface character (x) and replace it with nothing. You end up with the equal sign in the leading position, and Excel now parses the cells as formulas, just as you want.
Another approach is to use a more complex formula to accommodate the need of decreasing references. In this instance you can do it using the INDIRECT function, in this manner:
Paste this into cell A1 and then copy it down through cell A150. It works because you are subtracting the current row number from 151, adding a "B" to the front of it, and then using INDIRECT to reference the value in that calculated cell address. Obviously, if you want to reference a different cell (other than starting with B150), you'll need to adjust the formula so that the proper cell address is calculated.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8443) applies to Microsoft Excel 2007, 2010, and 2013.
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!
For some operations and functions, Excel allows you to use wild card characters. One such character is an asterisk. What ...Discover More
There are times when it can be beneficial to combine both numbers and text in the same cell. This can be easily done ...Discover More
The FIND and SEARCH functions are great for finding the initial occurrence of a character in a text string, but what if ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
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.