I’m using this formula in Column E of a worksheet to keep a running total which is increased by an entry in C and decreased by an entry in D: =IF(AND(C2=””,D2=””),””,E1+C2-D2). I’ve filled the formula down in Column E far enough to give me plenty of space for entries in any given accounting period. Occasionally I need to insert a row somewhere among the completed entries. How can I alter this formula to get Excel to insert it in Column E of the new row and update all the following values in Column E?
Clark
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Update formula for inserted row (97, SR-2)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Update formula for inserted row (97, SR-2)
- This topic has 7 replies, 3 voices, and was last updated 22 years, 4 months ago.
AuthorTopicWSaltdotcom
AskWoody LoungerAugust 13, 2002 at 1:09 am #374905Viewing 0 reply threadsAuthorReplies-
macropod
AskWoody_MVPAugust 13, 2002 at 2:32 am #608018Hi Clark,
If you just want to be able to copy your formula into the new row, without having to update the row below, you could use:
=IF(AND(C2=””,D2=””),””,OFFSET(E2,-1,0)+C2-D2)However, if you want Excel to automatically insert the formula into the new row as well, you’ll need an event-driven macro that fires every time you insert a new row into a defined range.
Cheers
Cheers,
Paul Edstein
[Fmr MS MVP - Word] -
WSaltdotcom
AskWoody Lounger -
H. Legare Coleman
AskWoody PlusAugust 17, 2002 at 10:44 pm #609332Something like this should do it. It will insert a row above the row which contains the selected cell and then fix up the formula in column E.
Sub InsertRow() Dim lRow As Long lRow = Selection.Row - 1 With ActiveSheet Selection.EntireRow.Insert Range("E1").Offset(lRow - 1, 0).AutoFill _ Destination:=Range(.Range("E1").Offset(lRow - 1, 0), .Range("E1").Offset(lRow + 1, 0)), _ Type:=xlFillDefault End With End Sub
-
WSaltdotcom
AskWoody Lounger -
WSaltdotcom
AskWoody LoungerFebruary 1, 2003 at 8:58 pm #649763This macro works very well for me. However, sometimes I would like to delete an entire row because it’s a duplicate entry or for some other reason. This messes up the balance in every subsequent row. My only recourse is to leave the incorrect entry and change its value to 0. Do I need a “delete row” macro now?
Clark -
H. Legare Coleman
AskWoody PlusFebruary 2, 2003 at 12:54 am #649808The VBA routine below should delete the row containing the active cell and then fix up the formulas in column E.
Public Sub DelCurRow() Dim oCell As Range, lLastRow As Long lLastRow = ActiveSheet.Range("E1").Offset(ActiveSheet.UsedRange.Row + _ ActiveSheet.UsedRange.Rows.Count, 0).End(xlUp).Row If ActiveCell.Row <= 2 Then Exit Sub Set oCell = ActiveSheet.Range("E1").Offset(ActiveCell.Row - 2, 0) ActiveCell.EntireRow.Delete oCell.AutoFill Destination:=Range(oCell, _ ActiveSheet.Range("E1").Offset(lLastRow - 1, 0)), _ Type:=xlFillDefault End Sub
-
WSaltdotcom
AskWoody Lounger
-
-
-
-
Viewing 0 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Frustrating search behavior with Outlook
by
MrJimPhelps
2 hours, 28 minutes ago -
June 2025 Office non-Security Updates
by
PKCano
5 hours, 41 minutes ago -
Secure Boot Update Fails after KB5058405 Installed
by
SteveIT
1 hour, 2 minutes ago -
Firefox Red Panda Fun Stuff
by
Lars220
5 hours, 37 minutes ago -
How start headers and page numbers on page 3?
by
Davidhs
16 hours, 1 minute ago -
Attack on LexisNexis Risk Solutions exposes data on 300k +
by
Nibbled To Death By Ducks
10 hours, 36 minutes ago -
Windows 11 Insider Preview build 26200.5622 released to DEV
by
joep517
1 day ago -
Windows 11 Insider Preview build 26120.4230 (24H2) released to BETA
by
joep517
1 day ago -
MS Excel 2019 Now Prompts to Back Up With OneDrive
by
lmacri
14 hours, 25 minutes ago -
Firefox 139
by
Charlie
7 hours ago -
Who knows what?
by
Will Fastie
1 hour, 32 minutes ago -
My top ten underappreciated features in Office
by
Peter Deegan
1 day, 1 hour ago -
WAU Manager — It’s your computer, you are in charge!
by
Deanna McElveen
19 hours, 51 minutes ago -
Misbehaving devices
by
Susan Bradley
35 minutes ago -
.NET 8.0 Desktop Runtime (v8.0.16) – Windows x86 Installer
by
WSmeyerbos
2 days, 7 hours ago -
Neowin poll : What do you plan to do on Windows 10 EOS
by
Alex5723
4 hours, 44 minutes ago -
May 31, 2025—KB5062170 (OS Builds 22621.5415 and 22631.5415 Out-of-band
by
Alex5723
2 days, 5 hours ago -
Discover the Best AI Tools for Everything
by
Alex5723
1 day, 5 hours ago -
Edge Seems To Be Gaining Weight
by
bbearren
1 day, 20 hours ago -
Rufus is available from the MSFT Store
by
PL1
2 days, 4 hours ago -
Microsoft : Ending USB-C® Port Confusion
by
Alex5723
3 days, 7 hours ago -
KB5061768 update for Intel vPro processor
by
drmark
1 day, 6 hours ago -
Outlook 365 classic has exhausted all shared resources
by
drmark
1 day, 5 hours ago -
My Simple Word 2010 Macro Is Not Working
by
mbennett555
3 days, 2 hours ago -
Office gets current release
by
Susan Bradley
3 days, 5 hours ago -
FBI: Still Using One of These Old Routers? It’s Vulnerable to Hackers
by
Alex5723
4 days, 19 hours ago -
Windows AI Local Only no NPU required!
by
RetiredGeek
4 days, 4 hours ago -
Stop the OneDrive defaults
by
CWBillow
4 days, 20 hours ago -
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
5 days, 6 hours ago -
X Suspends Encrypted DMs
by
Alex5723
5 days, 8 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.