LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
ParTeeGolfer
 
Posts: n/a
Default

Ron,

This helped out and did exactly what I needed.
Thanks for the help!!
"Ron Rosenfeld" wrote:

On Sat, 8 Jan 2005 17:41:02 -0800, ParTeeGolfer
wrote:

Ok, I am tring to figure out how to automaticlly keep track of a column with
wins and losses in it containing "L" or "W" and detrmine the longest winning
streak

EXAMPLE:

W
L
W
W
W
W
L
W
W
L

By looking at the column I can tell that the longest winning streak is 4.
How can I create a formula to keep track of this automatically?

Any Suggestions?

Please Help!


A formula solution is pretty complicated. You can adapt Harlan's solution in
the thread at
http://groups-beta.google.com/group/...fe0c55d264800d

A UDF might be simpler. To enter this, <alt<F11 opens the VB editor. Ensure
your project is highlighted in the project explorer, then Insert/Module and
paste the code below into the window that opens.

To use this UDF, enter the formula =MAXWINSTREAK(A1:A10) (or some other range)
into some cell. Read the answer 4 from your example.

=========================
Function MaxWinStreak(rg As Range) As Integer
Const Wins As String = "W"
Dim c As Range
Dim TempWins As Integer

For Each c In rg
If c.Text = Wins Then
TempWins = TempWins + 1
Else
If TempWins MaxWinStreak Then MaxWinStreak = TempWins
TempWins = 0
End If
Next c

End Function
========================


--ron

 
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
Winning Streak ParTeeGolfer Excel Worksheet Functions 4 December 31st 04 11:08 PM


All times are GMT +1. The time now is 07:49 AM.

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

About Us

"It's about Microsoft Excel"