subtotal

  • Thread starter Thread starter Alam
  • Start date Start date
A

Alam

As figure shown below I want the sub total shown on right side of figure
column, to be automatically calculated by Excel formula or VBA macro.(e.g
when the empty cell appear in the figure column accordingly subtotal
calculated in right side of the figure column.

1,710.60
1,661.10 3,371.70

2,404.00
1,020.00
1,907.40
1,753.08
2,560.30
2,825.90 12,470.68

1,965.60
1,625.60 3,591.20

2,302.20 2,302.20

2,429.10 2,429.10

2,006.40 2,006.40

Regards
 
Hi

One way
Enter in B2
=IF(A3="",SUM($A$1:A2)-SUM($B$1:B1),"")
and copy down
 
Here is a simple macro


Sub add_totals()

LastRow = Cells(Rows.Count, "A").End(xlUp).Row
FirstRow = 1
For RowCount = 1 To LastRow
If Range("A" & (RowCount + 1)) = "" Then
Range("B" & RowCount).Formula = _
"=sum(A" & FirstRow & ":A" & RowCount & ")"
End If
If Range("A" & RowCount) = "" Then
FirstRow = RowCount + 1
End If
Next RowCount

End Sub
 
Hi,Mr. Joel
Thanks it is great, and if you don’t mind there is small request, I want
this same Macro idea to be Macro in UDF.
Thanks & Regards
 
Doing this functtion in UDF has no advantae than just using a SUM worksheet
function.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Absolute value 2
Calculating subtotals 22
percent of row in subtotal range 1
labels for subtotals 1
Formulas, Please help!!! 2
Divide two numbers in data subtotal function 2
Formula Array - Syntax Error 4
Subtotal 10

Back
Top