![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Posts: 90
|
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
__________________
SteveD |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
Code:
Function SumStrange(Rng As Range) As Variant
SumStrange = Application.Sum(Range(Rng.Range("A1"), Rng.Range("A1").End(xlUp)))
End Function
=SumStrange(A3) for a result of 6 |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Posts: 90
|
Cool! Thank you very much, this will be a huge time saver!
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|