Creating dynamic Sum range if total is at the top of range

bearcub

Well-known Member
Joined
May 18, 2005
Messages
734
Office Version
  1. 365
  2. 2013
  3. 2010
  4. 2007
Platform
  1. Windows
Years ago I learned of an excel hack where you could replace the last range reference in a range with a cell refence using the name manager. The sum formula would have to be below the table like this:

1730748738086.png


The formula, as you can see is in AG 75. I replace the AG 74 will the RA which references the row above the $710,248.89.

Within the help of the name manager and RA range, if I wanted to include new values after row 73 I would need to manually change the cell range from AG 73 to AG74.

Is there a way to create an expanding range for formulas that would be added to the top of table. Meaning, if I inserted a row at the top of the table so the formula was in AG1, the RA formula would not work because I would not be referencing the cell before the formula. I looked at using the Index formula as the second range parameter but that includes a fixed range so it would not excpand.

Could I use the CountA function to replace the cell reference: Sum(Ag2: AG73) to Sum (Ag2: Counta(Ag2:Ag1000))
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Or if you are going to put the SUM formula above the table, why not just make the formula =SUM(AG2:AG10000) or some other number that will easily allow for any amount of data you are likely to ever enter?
 
Upvote 0

Forum statistics

Threads
1,223,875
Messages
6,175,114
Members
452,613
Latest member
amorehouse

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