Looking for a dynamic summing formula

SteveD

Board Regular
Joined
Feb 20, 2002
Messages
104
I am looking for a formula that I can put in a cell such that it will sum each cell above it until it hits an empty cell. However, I am never sure how many numbers there will be in the column or where in the sheet the formula will be placed.
I think I’m looking for something like: sum(z:a), where z is the cell immediately above the formula and cell a is last cell going up before a blank cell. Can anyone help me out with how to code this?
Thanks for your time and effort,
Steve
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Code:
Function SumStrange(Rng As Range) As Variant
SumStrange = Application.Sum(Range(Rng.Range("A1"), Rng.Range("A1").End(xlUp)))
End Function

I you have in A1:A3, {1;2;3} then you could use this in A4 like

=SumStrange(A3)

for a result of 6
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,243
Members
448,555
Latest member
RobertJones1986

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