insert formula in bottom blank cell to subtotal upto blank cell

smeetony1

New Member
Joined
May 29, 2018
Messages
4
Hi all

I have a worksheet containing thousands of numbers dates and times. All of which I have separated by inserting blank row after time value change.

I now need the blank row to subtotal the cells between the two blanks. The number of cells is not the same between any
of the blanks.

Is there a solution?

Thanks in anticipation.

Tony
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
I can give you a VBA solution if you tell me what column you want the subtotals in...
 
Upvote 0
I will add a sample of the chart. I would need the subtotal to follow through in the blank cells. Up to the blank cell above.

Sat10:2219/05/20180.000.920.678.220.38
Mon10:2221/05/20180.001.681.227.270.00
SUB
Sun10:2501/04/20180.002.501.438.230.02
Mon10:2502/04/20180.001.130.377.420.00
Sun10:2508/04/2018
Sun10:2515/04/20180.000.870.436.500.00
Sun10:2522/04/20180.000.971.377.330.00
Sun10:2529/04/20180.004.873.955.870.00
Sun10:2506/05/20180.002.231.226.620.77
Mon10:2507/05/20180.000.752.389.520.00
Sun10:2513/05/20180.005.605.086.220.03
SUB
Sat11:2231/03/20180.002.071.658.400.00
Wed11:2204/04/20180.001.921.156.850.00

<tbody>
</tbody><colgroup><col><col><col><col span="5"></colgroup>


Thanks
 
Upvote 0
Am I reading correctly, you want the subtotals in Columns D, E, F, G, H.
 
Upvote 0
Does this do what you want.

Code:
Sub GetSubs5()


    Dim subt As Double
    Dim TopofSection As Long, lastrow As Long
    
    Application.ScreenUpdating = False
    lastrow = Cells(Rows.Count, "B").End(xlUp).Row
    Do Until lastrow < 2
        TopofSection = Cells(lastrow, "B").End(xlUp).Row
        If Cells(lastrow - 1, 2) = "" Then TopofSection = lastrow
        subt = WorksheetFunction.Sum(Range("D" & TopofSection, "D" & lastrow))
        Range("D" & lastrow).Offset(1, 0).Value = subt
        subt = WorksheetFunction.Sum(Range("E" & TopofSection, "E" & lastrow))
        Range("E" & lastrow).Offset(1, 0).Value = subt
        subt = WorksheetFunction.Sum(Range("F" & TopofSection, "F" & lastrow))
        Range("F" & lastrow).Offset(1, 0).Value = subt
        subt = WorksheetFunction.Sum(Range("G" & TopofSection, "G" & lastrow))
        Range("G" & lastrow).Offset(1, 0).Value = subt
        subt = WorksheetFunction.Sum(Range("H" & TopofSection, "H" & lastrow))
        Range("H" & lastrow).Offset(1, 0).Value = subt
        lastrow = Cells(TopofSection, 2).End(xlUp).Row
    Loop
    Application.ScreenUpdating = True
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,767
Messages
6,132,599
Members
449,738
Latest member
brianm3y3r

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