ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   subtotal (https://www.excelbanter.com/excel-programming/402460-subtotal.html)

Alam

subtotal
 
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



Roger Govier[_3_]

subtotal
 
Hi

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

--

Regards
Roger Govier

"Alam" wrote in message
...
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



joel

subtotal
 
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


"Roger Govier" wrote:

Hi

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

--

Regards
Roger Govier

"Alam" wrote in message
...
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




Alam

subtotal
 
Hi,Mr. Joel
Thanks it is great, and if you dont mind there is small request, I want
this same Macro idea to be Macro in UDF.
Thanks & Regards


"Joel" wrote:

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


"Roger Govier" wrote:

Hi

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

--

Regards
Roger Govier

"Alam" wrote in message
...
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




joel

subtotal
 
Doing this functtion in UDF has no advantae than just using a SUM worksheet
function.

"Alam" wrote:

Hi,Mr. Joel
Thanks it is great, and if you dont mind there is small request, I want
this same Macro idea to be Macro in UDF.
Thanks & Regards


"Joel" wrote:

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


"Roger Govier" wrote:

Hi

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

--

Regards
Roger Govier

"Alam" wrote in message
...
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




Yousoft

subtotal
 
Ok right, thanks for your help.

"Joel" wrote:

Doing this functtion in UDF has no advantae than just using a SUM worksheet
function.

"Alam" wrote:

Hi,Mr. Joel
Thanks it is great, and if you dont mind there is small request, I want
this same Macro idea to be Macro in UDF.
Thanks & Regards


"Joel" wrote:

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


"Roger Govier" wrote:

Hi

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

--

Regards
Roger Govier

"Alam" wrote in message
...
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





All times are GMT +1. The time now is 03:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com