Adding Rows without Changing a Cell Reference

Written by Allen Wyatt (last updated June 29, 2024)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


3

At the bottom of a column of data James has a SUM formula, such as =SUM(E$4:E76). When he inserts a row at row 4, the formula is automatically changed by Excel to =SUM(E$5:E77). James thought the dollar sign was supposed to "anchor" the row reference so it didn't change. He now wonders how he can insert rows at row 4 without having Excel modify the first cell reference in the formula.

There are a few ways to handle this, which I'll get to in a moment. First, however, it is important to understand how Excel views ranges and how it adjusts those ranges when inserting rows.

James has a range that extends from row 4 through row 76, a total of 73 rows. When you insert a row, Excel inserts the row (or rows) above whatever row you currently have selected. Thus, if you select row 10 and insert one row, then whatever was at row 10 (and all rows below that) is moved down to accommodate the new row. And, the range now extends from row 4 (above row 10) through row 77, for a total of 74 rows. It now goes through row 77 because, again, everything from the selected row (row 10) was moved down by one row.

Similarly, if you select row 4 and insert a single row, then the new row is inserted above row 4 and is, technically, outside the original range referenced in your SUM formula. This is why the range reference is modified.

Another way to look at this is what you would want to have happen to your formula if you deleted a row above your range of cells. If your data starts in row 4, what would you want to SUM if you deleted, say, row 2? After the row deletion, your data now starts in row 3, so you would want the range reference in the SUM formula to reflect the new range, not to be anchored to row 4.

This obviously brings up the question, then, of the dollar sign in the range reference. Dollar signs do, in a sense, "anchor" either the row or column that follows the dollar sign. However, the dollar sign, as anchor, only comes into play if you copy the formula to a different cell, not if you insert or delete rows.

So, this brings me to the different ways you make sure that the E4 cell reference doesn't change. Most of the methods involve the modification of the SUM formula. You could change it to this:

=SUM(INDIRECT("E4"):E76)

The INDIRECT function converts the string "E4" to a real Excel address. Excel won't change this because, as far as it is concerned, it is just a string. So, you're effectively hardcoding the cell reference to E4.

A second approach is to modify the formula in this manner:

=SUM(E$3:D76)

Notice that the first reference in the range is now E3 instead of E4. As long as cell E3 doesn't contain a numeric value, this will work great. (For instance, E3 could contain text or be blank, and there would be no deleterious effect on your sum.) You can now insert rows at row 4, and your range will expand as desired.

Finally, you could select your original range (E4:E76) and press Ctrl+L to convert the range to a table. Now you can insert rows at row 4 and your table will remain intact and behave as you desire.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13926) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Relative Worksheet References when Copying

Copy a formula from one cell to another on the same worksheet, and Excel adjusts any relative references in the formula ...

Discover More

Highlighting Pattern Violations

A common part of working with text strings in a worksheet is normalizing those strings so that they follow whatever rules ...

Discover More

Consolidating Changes under a Single User

When using Track Changes, you may want to have your edits appear to be those of a different user. Here's how to fool Word ...

Discover More

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!

More ExcelTips (ribbon)

Generating Numeric Testing Data

Excel can be used to generate random testing data that you can use in any way you deem necessary. This tip provides ...

Discover More

Address of a Cell in Which a Threshold is Exceeded

If you keep a lot of data in Excel, you may be interested in figuring out when that data surpasses a threshold. This tip ...

Discover More

Formula Shows Instead of Formula Result

When you enter a formula in a cell, you expect Excel to display the result of that formula once you are completed. If ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is two more than 7?

2024-07-03 05:35:26

Rene

I always add an empty row above and below the data (height 6 points) and include these in the sum formula, as part of the setup of the spreadsheet. Insertion or deletion of data rows will always be included in the formula, no extra effort needed. Ditto for columns (width 1). No need for the $ sign or conversion to table.
An extra advantage of the above is that you can give the data a range name, including the empty rows/columns, knowing that insertion/deletion will always be within the range.


2024-07-01 08:10:51

Rick Keevill

ONE OF THE MOST COMMON WAYS i DO THIS SORT OF THING IS SIMPLY REPLACE THE EQUAL SIGN WITH SOMETHING LIKE PPP THEN i ADD OR MOVE CELLS AND SIMPLY REPLACE THE PPP WITH THE EQUALS SIGN ONCE FINISHED


2024-06-30 07:44:28

Alex Blakenburg

Re: Conversion to a Table.
Typically you would convert the whole Data Range to a table not just the amount column.
Also since the first value is in E4 you would convert from E3 ie E3:E76 to a table, and tick "my table has headers" with E3 being the heading.
My preference is to use Ctrl+L as mentioned above since it works in all languages and is the default for Excel Online but most people are using Ctrl+T. (in VBA Tables are known as ListObjects hence the Ctrl+L)


This Site

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.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.