Summing data in a column

abberyfarm

Well-known Member
Joined
Aug 14, 2011
Messages
733
Hi there,

I need to sum data in a column A below so that it is totaled at each row in Column B.

A macro would be great as I need to call it in another macro.

Thank you

Excel Workbook
AB
111
212
3
4
513
614
7
814
9
10
1116
Sheet1
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Code:
Sub Running_Total()
    
    Dim a, i&, tot!
    
    With ActiveSheet
        a = .Range("A1", .Range("A" & Rows.Count).End(xlUp))
        For i = LBound(a, 1) To UBound(a, 1)
            tot = tot + a(i, 1)
            If a(i, 1) <> "" Then a(i, 1) = tot
        Next i
        .Range("A1", .Range("A" & Rows.Count).End(xlUp)).Offset(, 1) = a
    End With
End Sub
 
Upvote 0
Why is B8 = 4 ?
Is that supposed to be 5 ?


Try this in B1 and filled down

=IF(A1="","",SUM(A$1:A1))

Excel Workbook
AB
111
212
3 
4 
513
614
7 
815
9 
10 
1116
Sheet1
 
Upvote 0

Forum statistics

Threads
1,203,462
Messages
6,055,562
Members
444,799
Latest member
CraigCrowhurst

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