Thread: Summarize areas
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Summarize areas

Should do it

Sub sumblocks()
Dim mc, i, x As Long
mc = 4 ' col D change to suit
For i = Cells(Rows.Count, mc). _
End(xlUp).Row To 2 Step -1
If Len(Application.Trim(Cells(i + 1, mc))) < 1 Then
Cells(i + 1, mc) = ""
x = Cells(i, mc).End(xlUp).Row
Cells(i, mc).Offset(, 1).Value = _
Application.Sum(Range(Cells(i, mc), Cells(x, mc)))
End If
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Kjellk" wrote in message
...
I would like to take the highest value minus the lowest value in groups
that
are divided by a blank row. The group can consist of different number of
rows. Would like to have the result in the cell to the right of the row at
the bottom of the group.

This is how it looks

16235
16300
16368 (Sum here!)

16375
16419
16442
16481 (Sum here!)