Automatically adjusting SUM formula when adding rows at the bottom

lumahai

New Member
Joined
Feb 6, 2017
Messages
14
Hello everyone!

I need some help figuring out how to work out a SUM formula that would "dynamically adjust" itself "auto adjust" itself when rows are added at the bottom of the sum range I have right now defined.

Here is a screenshot illustration:

1694102227787.png



For example, as you can see I have a Hardware infra total for Baseline and Adjustment columns. The basic idea is that cell D10 would SUM(D7:D9) but if I insert a row below Row 9, the sum formula would not include this added row. I remember a formula around with OFFSET or INDIRECT and the result was that the formula would "self-adjust" to include the added row(s). But i dont remember the details into it.

I saw another thread mention you could do a named range type of setup, to follow is the mention....

"To get your formula to work that way, you could use a Named Range

Select cell B2 and define a name, Name:aboveMe RefersTo: =Sheet1!B1

Adjust the sheet name as needed, but the relative addressing is critical

Then, in D10, the formula =SUM($I$6:aboveMe) will adjust as rows are inserted or deleted, similarly for =SUM($K$6:aboveMe) in F10"

Link: Dynamically adjusting SUM formula when adding rows at the bottom



However, I am not sure if the above mention actually works for the request I am seeking. I tried it and it would only update the SUM when rows are added above D6, not D10.
I could definitely be wrong in that assumption and not as well educated.

So again, basically I am looking for a formula that would sum all the Total amount row corresponding when rows are added just above, or generally above the total row.

Any further clarification just let me know! Any education is appreciated.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try...

D10:

Excel Formula:
=SUM(D7:INDEX(D:D,ROW()-1))

Hope this helps!
 
Upvote 0
Try...

D10:

Excel Formula:
=SUM(D7:INDEX(D:D,ROW()-1))

Hope this helps!
So far this seems to be working! Thank you for the help. I am curious, could you give me a quick education as to what the formula is saying? That way i know for future case when this could be applicable. I am trying to build out my knowledge.

Again , thank you this is awesome!
 
Upvote 0
Normally, the INDEX function returns a value from within a range.

So, in your example, INDEX(D:D,ROW()-1) returns the value $26,950.00...

Excel Formula:
=INDEX(D:D,ROW()-1)

=INDEX(D:D,10-1)

=INDEX(D:D,9)

= $26,950.00

However, when you have D7:INDEX(D:D,ROW()-1), it returns a reference to a range, not a value. So now we have the following...

Excel Formula:
=SUM(D7:INDEX(D:D,ROW()-1))

=SUM(D7:INDEX(D:D,10-1))

=SUM(D7:INDEX(D:D,9))

=SUM(D7:D9)

=$51,436.00

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top