Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Loop and running total

I need to loop from row 50 to 1, step -1. Addin the values in Col A is equal
as long as they are equal to the one above. How can i keep a running total
that adds the value in A every time it repeats?

Thanks in advance


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Loop and running total

Luis,

Use a worksheet function:

=SUMPRODUCT((A1:A49=A2:A50)*A2:A50)

or in a macro

Sub TotalCalA()
Dim i As Long
Dim TotalA As Double
For i = 50 to 2 Step -1
If Cells(i,1).Value = Cells(i-1,1).Value Then
TotalA = TotalA + Cells(i,1).Value
End if
Next i
Msgbox TotalA
End Sub

HTH,
Bernie
MS Excel MVP



"LuisE" wrote in message
...
I need to loop from row 50 to 1, step -1. Addin the values in Col A is
equal
as long as they are equal to the one above. How can i keep a running total
that adds the value in A every time it repeats?

Thanks in advance



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Duplicate Running Total Grand Total In Pivot Table Mathew P Bennett[_2_] Excel Discussion (Misc queries) 1 August 17th 08 03:13 AM
Running total of Found Substrings in MainString in Big Loop ExcelMonkey Excel Programming 1 January 17th 08 07:52 PM
running total and average of that total after 3 events belvy123 Excel Discussion (Misc queries) 0 March 28th 07 02:57 AM
running total and average of that total after 3 events Toppers Excel Discussion (Misc queries) 1 March 28th 07 02:19 AM
% of Running Total to Grand Total in Pivot Table David Excel Programming 0 August 17th 05 08:24 PM


All times are GMT +1. The time now is 04:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"