Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Count between Values
I would you count zero values between real values inclusive?
Hopefully in VBA Such as: A B C 1 2 2 0 3 0 4 1 count 4 5 1 6 0 7 1 count 3 8 1 9 1 count 2 10 8 11 0 12 2 count 3 With Thanks Steve |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Count between Values
Sub Test()
Dim iLastRow As Long Dim i As Long Dim iStart As Long iLastRow = Cells(Rows.Count, "B").End(xlUp).Row iStart = 1 For i = 2 To iLastRow If Cells(i, "B").Value < 0 Then Cells(i, "C").Value = i - iStart + 1 iStart = i + 1 i = i + 1 End If Next i End Sub -- HTH RP (remove nothere from the email address if mailing direct) "smandula" wrote in message ... I would you count zero values between real values inclusive? Hopefully in VBA Such as: A B C 1 2 2 0 3 0 4 1 count 4 5 1 6 0 7 1 count 3 8 1 9 1 count 2 10 8 11 0 12 2 count 3 With Thanks Steve |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Count between Values
Thanks a lot!!
Works perfectly Thanks Again Steve |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Count between Values
R = 1
Do While Cells(R, 1) < "" ZeroCnt = 0 Flag = 0 Do While Cells(R, 2) = 0 ZeroCnt = ZeroCnt + 1 R = R + 1 Flag = 1 Loop If Flag = 0 Then R = R + 1 If Flag = 1 Then Cells(R, 3) = "count " & ZeroCnt + 2 Loop |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Count Intervals of 2 Consecutive Values in same Row and Return Count across Row | Excel Worksheet Functions | |||
Count Intervals of 2 Numeric values in same Row and Return Count across Row | Excel Worksheet Functions | |||
Count unique values and create list based on these values | Excel Worksheet Functions | |||
Count Intervals of Filtered TEXT values in Column and Return Count across a Row | Excel Worksheet Functions | |||
Using the COUNT funciton to count cells with values | Excel Programming |