So you would be looking at a row like this for data:
result W W L L L L W L
and starting from a specified cell, go backwards, counting either L's or
W's, until there was a result that didn't match. Also note that games which
haven't been played yet will have a blank cell.
For example: W, W, L (stop counting) - gives result W2
Thanks in advance,
Joe Casaletto
Assume the simple W W L L L L W L array you
gave goes from cells a1 to h1. The following formula will
give you the number of consecutive W by finding the
location of the first L in the array and subtracting 1 to
give the location of the last W in the run. The
concatenation simply presents the result as "W" + the
location of the last W in the run. Check out help for info
on the match function.
=CONCATENATE("W",MATCH("L",A1:H1,0)-1)
Good luck
Matt
>.
>
=if(match("L",A1:H1,0)=1,concatenate("L",match
("W",A1:H1,0)-1),concatenate("W",match("L",A1:H1,0)-1))
Matt
>.
>
Thanks,
--
Joe Casaletto
http://www.joecasaletto.com
"MattMogul" <mste...@idx.com.au> wrote in message
news:10b401c18615$9a0c7f30$a5e62ecf@tkmsftngxa07...
1st, I borrowed the "reverse cell contents" from www.cpearson.com
2nd, assuming your win/loss letters are in A1:H1
3rd, I put the reverse cell formula in A2 (it's an ARRAY formula) and filled it
across to H2.
=OFFSET(rowlist,0,MAX(COLUMN(revrowlist))-COLUMN())
(see CPearson's site if you have questions on this)
The "rowlist" name is the original list (i.e., row 1) and the "revrowlist" name
is the new list (i.e. row 2)
4th, this formula goes somewhere else:
="W"&MATCH("L",INDIRECT(ADDRESS(2,MATCH("W",A2:H2,0)+1)&":H2"),0)
and should show you the streak of wins.
This one show the streak of losses:
="L"&MATCH("W",INDIRECT(ADDRESS(2,MATCH("L",A2:H2,0)+1)&":H2"),0)
Did I do what you wanted?
="W"&IF(ISERROR(MATCH("L",INDIRECT(ADDRESS(2,MATCH("W",A2:H2,0)+1)&":H2"),0)),COUNTA(INDIRECT(ADDRESS(2,MATCH("W",A2:H2,0)+1)&":H2"))+1,MATCH("L",INDIRECT(ADDRESS(2,MATCH("W",A2:H2,0)+1)&":H2"),0))
Switch the W's and L's for losses.
="W"&IF(ISERROR(MATCH("L",INDIRECT(ADDRESS(2,MATCH("W",A2:H2,0)+1)&":H2"),0)),COUNTIF(A2:H2,"W"),MATCH("L",INDIRECT(ADDRESS(2,MATCH("W",A2:H2,0)+1)&":H2"),0))
=A1&MOD(
MIN(IF($A$1:A1<>A1,COLUMNS($A$1:A1)+CELL("col",$A$1:A1)-COLUMN($A$1:A1)))-1,
COLUMNS($A$1:A1)+1)
Then, copy it to B2, C2, etc.
Results (with the above data) would be
{"L1","W1","L1","W1","L1","W1","W2","W3"}
Let me know if this works for you.
Regards,
Daniel M.
"Joseph D. Casaletto" <spamall...@netscape.net> wrote in message
news:9vhfk...@enews1.newsguy.com...
Array Enter the following for row 3
=COUNTIF(A3:H3,">""")-MAX(IF(A3:H3="L",A1:H1))
HTH Dave Patton
Joseph D. Casaletto wrote in message <9vhfk...@enews1.newsguy.com>...
--
Joe Casaletto
"David G. Patton" <pat...@cadvision.com> wrote in message
news:#ELQtkphBHA.2212@tkmsftngp03...
Formula at end of Row Array Entered Ctrl-Shift-Enter (CSE)
=IF(I5="W","W"&COLUMN()-1-MAX(IF($A5:I5="L",$A$1:I$1)),"L"&COLUMN()-1-MAX(IF
($A5:I5="W",$A$1:I$1)))
David G. Patton wrote in message <#ELQtkphBHA.2212@tkmsftngp03>...
I could not find the reverse cell contents reference on
the site that you mentioned. Could you post the precise
url so that I can find it. The only time I was confronted
with this problem I had to write a vba procedure to do
reverse the order of members of a range object...glad to
see someone has written a function to do it so I am
interested in see how it works.
Thanks
Matt
>.
>
My only suggestion is to use a custom function to create a
text string in reverse order and then find the L and W in
the string to get your answer. You will need to copy the
following code into VBA. It is a custom function.
1.Open visual basic tools/macro/visual basic editor
2.Insert a new module. In the VBA window insert/module
3. Copy this code and paste in the module window (RHS
screen)
Function MakeReverseString(rngResults As Range)
Dim intFinish As Integer
Dim arrResults As Variant
Dim strRevString As Variant
On Error GoTo HandleErr
intFinish = rngResults.Columns.Count
arrResults = rngResults.Value
strRevString = ""
For i = intFinish To 1 Step -1
strRevString = strRevString + arrResults(1, i)
Next i
MakeReverseString = strRevString
ExitHere:
Exit Function
HandleErr:
Select Case Err.Number
Case Else
MsgBox "Error " & Err.Number & ": " &
Err.Description,
vbCritical, "Module1.MakeReverseString" 'ErrorHandler:$$N=
Module1.MakeReverseString
End Select
' End Error handling block.
End Function
4. In your spreadsheet to get the result copy this
formula. Not pretty but...
=IF(ISERROR(FIND("L",MakeReverseString
(Result))),"W"&COLUMNS(Result),IF(ISERROR(FIND
("W",MakeReverseString(Result))),"L"&COLUMNS(Result),IF
(FIND("L",MakeReverseString(Result))=1,"L"&FIND
("W",MakeReverseString(Result))-1,"W"&FIND
("L",MakeReverseString(Result))-1)))
In my formula I have named the range of cells L W etc
as "result". To test in your sheet simply replace the
word result with your range.
It works
>.
>
http://www.cpearson.com/excel/lists.htm#ReverseOrder
The formulas are on my "Working With Lists" page.
http://www.cpearson.com/excel/lists.htm#ReverseOrder .
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com ch...@cpearson.com
"MattMogul" <mste...@idx.com.au> wrote in message
news:15a001c186e5$bed57ee0$3bef2ecf@TKMSFTNGXA10...
>.
>
=IF(OFFSET(B6,0,Y6-1)="W",Y6-MAX((B6:U6="L")*(rNum))& "
Wins",Y6-MAX((B6:U6="W")*(rNum))& " Losses")
Joseph D. Casaletto wrote in message <9vk0o...@enews2.newsguy.com>...