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
-
X Suspends Encrypted DMs
by
Alex5723
1 hour, 41 minutes ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
1 hour, 58 minutes ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
2 hours, 36 minutes ago -
OpenAI model sabotages shutdown code
by
Cybertooth
3 hours, 13 minutes ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
2 hours, 36 minutes ago -
Enabling Secureboot
by
ITguy
6 hours, 22 minutes ago -
Windows hosting exposes additional bugs
by
Susan Bradley
11 hours, 7 minutes ago -
No more rounded corners??
by
CWBillow
6 hours, 55 minutes ago -
Android 15 and IPV6
by
Win7and10
56 minutes ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
23 hours, 28 minutes ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
1 day, 2 hours ago -
Windows 11 Insider Preview Build 26100.4202 (24H2) released to Release Preview
by
joep517
20 hours, 44 minutes ago -
Windows Update orchestration platform to update all software
by
Alex5723
1 day, 9 hours ago -
May preview updates
by
Susan Bradley
20 hours, 52 minutes ago -
Microsoft releases KB5061977 Windows 11 24H2, Server 2025 emergency out of band
by
Alex5723
12 hours, 27 minutes ago -
Just got this pop-up page while browsing
by
Alex5723
1 day, 1 hour ago -
KB5058379 / KB 5061768 Failures
by
crown
22 hours, 45 minutes ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
56 minutes ago -
At last – installation of 24H2
by
Botswana12
2 days, 1 hour ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
12 hours, 3 minutes ago -
RyTuneX optimize Windows 10/11 tool
by
Alex5723
2 days, 13 hours ago -
Can I just update from Win11 22H2 to 23H2?
by
Dave Easley
11 hours, 39 minutes ago -
Limited account permission error related to Windows Update
by
gtd12345
3 days, 2 hours ago -
Another test post
by
gtd12345
3 days, 2 hours ago -
Connect to someone else computer
by
wadeer
2 days, 21 hours ago -
Limit on User names?
by
CWBillow
3 days ago -
Choose the right apps for traveling
by
Peter Deegan
2 days, 14 hours ago -
BitLocker rears its head
by
Susan Bradley
1 day, 22 hours ago -
Who are you? (2025 edition)
by
Will Fastie
1 day, 21 hours ago -
AskWoody at the computer museum, round two
by
Will Fastie
2 days, 16 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.