ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How use summation? (https://www.excelbanter.com/excel-programming/333672-how-use-summation.html)

Akaplen

How use summation?
 

Hi There,

I am trying to write a macro that get the total (Sum of Column B) of a
column if row is infinite (meaning number of rows varied up to 5000
rows). Please see example data below.

A B
Invoice Summary Report
Account Total Amount Due
9 $24.94
22 $346.40
27 $153.34
42 $202.58
48 $31.24
53 $120.97
3671060 $3,484.06

Any help is very much appreciated. Thanks
Andrew


--
Akaplen
------------------------------------------------------------------------
Akaplen's Profile: http://www.excelforum.com/member.php...o&userid=24926
View this thread: http://www.excelforum.com/showthread...hreadid=384645


jmagdziarz[_2_]

How use summation?
 

Can you just use the following?

sum(B:B)


--
jmagdziarz
------------------------------------------------------------------------
jmagdziarz's Profile: http://www.excelforum.com/member.php...o&userid=23108
View this thread: http://www.excelforum.com/showthread...hreadid=384645


Toppers

How use summation?
 
Hi,


Assuming data starts in B2:

Sub InvTot()
Dim tot As Double
Set rng = Range("b2:b" & Cells(Rows.Count, "b").End(xlUp).Row)
tot = Application.Sum(rng)
End Sub

HTH

"Akaplen" wrote:


Hi There,

I am trying to write a macro that get the total (Sum of Column B) of a
column if row is infinite (meaning number of rows varied up to 5000
rows). Please see example data below.

A B
Invoice Summary Report
Account Total Amount Due
9 $24.94
22 $346.40
27 $153.34
42 $202.58
48 $31.24
53 $120.97
3671060 $3,484.06

Any help is very much appreciated. Thanks
Andrew


--
Akaplen
------------------------------------------------------------------------
Akaplen's Profile: http://www.excelforum.com/member.php...o&userid=24926
View this thread: http://www.excelforum.com/showthread...hreadid=384645




All times are GMT +1. The time now is 08:51 PM.

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