![]() |
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 |
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 |
All times are GMT +1. The time now is 12:40 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com