Thread
:
Find longest consecutive winning streaks
View Single Post
#
4
Posted to microsoft.public.excel.worksheet.functions
Don Guillett
external usenet poster
Posts: 10,124
Find longest consecutive winning streaks
From a post of mine about a month ago. Modify to suit
Try this where text in col a and numbers in col 2-11
Sub findlongestzeros()
For i = 1 To Cells(Rows.Count, "a").End(xlUp).Row
mc = 0
For j = 2 To 11
If Cells(i, j) = 0 And Cells(i, j + 1) = 0 Then mc = mc + 1
Next j
'MsgBox mc
If mc mss Then
mss = mc
mr = i
End If
Next i
MsgBox "Max is Row " & mr
'MsgBox mss
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"trey1982" wrote in message
...
My data set is a series of monthly returns (in percentages) for an
investment. How can I go about finding which time period has the longest
consecutive winning months and what the return over that time period was.
Then find the second and third longest winning streaks which cannot be
contained in the longest one.
thanks in advance... trey
Jan-04 1.37%
Feb-04 0.99%
Mar-04 0.12%
Apr-04 -0.45%
May-04 -0.18%
Jun-04 0.30%
Jul-04 -0.21%
Aug-04 0.38%
Sep-04 0.74%
Oct-04 0.37%
Nov-04 1.50%
Dec-04 1.40%
Jan-05 0.39%
Feb-05 1.44%
Mar-05 -0.09%
Apr-05 -0.74%
May-05 0.88%
Jun-05 1.31%
Jul-05 1.53%
Aug-05 0.82%
Sep-05 1.63%
Oct-05 -1.50%
Nov-05 1.59%
Dec-05 1.93%
Jan-06 2.76%
Feb-06 0.47%
Mar-06 0.93%
Apr-06 1.63%
May-06 -1.65%
Jun-06 -0.68%
Jul-06 -0.03%
Aug-06 0.84%
Sep-06 0.28%
Oct-06 1.24%
Nov-06 1.52%
Dec-06 1.35%
Jan-07 1.44%
Feb-07 0.83%
Mar-07 1.58%
Apr-07 1.73%
May-07 1.91%
Jun-07 0.90%
Jul-07 1.01%
Aug-07 -1.38%
Sep-07 2.05%
Oct-07 2.83%
Reply With Quote
Don Guillett
View Public Profile
Find all posts by Don Guillett