Calculating the current win streak

mjennaro

New Member
Joined
Nov 26, 2013
Messages
12
So, there are a lot of questions related to displaying a cell with the current winning or losing streak for a team.

There are also a lot of variations in the way people have their data setup and this affects the formula needed to retrieve what is needed.

My data set has the streak displayed with a 1 for a win and a 0 for a loss and a .5 for a tie. The data is all contained in 3 rows as follows:

abcdefghij
101.51111W4
0000110.5T1
11110100L2

<tbody>
</tbody>

What I am looking for is a way to calculate the formula in column J so that the streak is displayed. If my data increased by 1 more column as follows, the output in column j would be automatically updated to show:

abcdefghij
101.511110L1
0000110.51W1
111101001W1

<tbody>
</tbody>


Thanks in advance.
 
Last edited:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hello mjennaro, welcome to MrExcel, try this formula for J2

=HLOOKUP(LOOKUP(2,A2:I2),{0,1,0.5;"L","W","T"},2,0)&COUNTIF(INDEX(A2:I2,IFERROR(MATCH(2,INDEX(1/(A2:I2<>LOOKUP(2,A2:I2))/(A2:I2<>""),0)),0)+1):I2,LOOKUP(2,A2:I2)
)
 
Upvote 0
Hello mjennaro, welcome to MrExcel, try this formula for J2


=HLOOKUP(LOOKUP(2,A2:I2),{0,1,0.5;"L","W","T"},2,0)&COUNTIF(INDEX(A2:I2,IFERROR(MATCH(2,INDEX(1/(A2:I2<>LOOKUP(2,A2:I2))/(A2:I2<>""),0)),0)+1):I2,LOOKUP(2,A2:I2)

)

Hi Barry,

I think there is a typo in your formula - the parenthesis in red is misplaced

Shouldn't it be ?

=HLOOKUP(LOOKUP(2,A2:I2),{0,1,0.5;"L","W","T"},2,0)&COUNTIF(INDEX(A2:I2,IFERROR(MATCH(2,INDEX(1/(A2:I2<>LOOKUP(2,A2:I2))/(A2:I2<>""),0)),0)+1):I2,LOOKUP(2,A2:I2))


Another possible solution

J2
=LOOKUP(LOOKUP(2,$A2:$I2),{0;0.5;1},{"L";"T";"W"})&COUNT($A2:$I2)-IFERROR(LOOKUP(2,1/(($A2:$I2<>"")*($A2:$I2<>LOOKUP(2,$A2:$I2))),COLUMN($A2:$I2)-COLUMN($A2)+1),0)

M.
 
Upvote 0
Similar to a query posted earlier...

Define BigNum as referring to:

=9.99999999999999E+307

J2, control+shift+enter, not just enter:
Rich (BB code):
=LOOKUP(LOOKUP(BigNum,A2:I2),{0,"L";0.5,"T";1,"W"})&
  LOOKUP(BigNum,1/(1/FREQUENCY(IF(IF(A2:I2="","#",A2:I2)=LOOKUP(BigNum,A2:I2),COLUMN(A2:I2)),
  IF(A2:I2<>LOOKUP(BigNum,A2:I2),COLUMN(A2:I2)))))

This set up won't be affected by the empty cells in-between.

If you allow for the following in K2, copied down...
Rich (BB code):
=LOOKUP(BigNum,A2:I2)

J2 becomes:
Rich (BB code):
=LOOKUP(K2,{0,"L";0.5,"T";1,"W"})&
  LOOKUP(BigNum,1/(1/FREQUENCY(IF(IF(A2:I2="","#",A2:I2)=K2,COLUMN(A2:I2)),
  IF(A2:I2<>K2,COLUMN(A2:I2)))))
 
Upvote 0
Thank you, Barry and Marcelo. I was not able to replicate Marcelo's solution across the various rows in my workbook. However, Barry's did work across all rows (missing end parenthasis, not withstanding). One further question: I forgot to mention that I have the word phrase "bye" in some cells to indicate that the team does not play a game that week. Any insight on how to ignore this word phrase yet continue to calculate numbers that make up the streak?

a
bcdefghij
1010.511bye11W4
00001100.5byeT1
111101bye00L2

<tbody>
</tbody>

Thanks.

Michael
 
Upvote 0
Thank you, Barry and Marcelo. I was not able to replicate Marcelo's solution across the various rows in my workbook. However, Barry's did work across all rows (missing end parenthasis, not withstanding). One further question: I forgot to mention that I have the word phrase "bye" in some cells to indicate that the team does not play a game that week. Any insight on how to ignore this word phrase yet continue to calculate numbers that make up the streak?

a

b
c
d
e
f
g
h
i
j
1
1
0.5
1
1
bye
1
1
W4
1
1
0.5
bye
T1
1
1
1
1
1
bye
L2

<TBODY>
</TBODY>

Thanks.

Michael

What about the third option?!...
 
Upvote 0
What about the third option?!...

Ha! Aladin, I am a man of simple means that sticks with an option once it is proven to meet his needs. If you are saying that your solution solves the "bye" problem as well, I will try it and let you know as much.

Thanks.

Michael
 
Upvote 0
A small change to my suggestion can make it work with "bye"s too

=HLOOKUP(LOOKUP(2,A2:I2), {0,1,0.5;"L","W","T"},2,0)&COUNTIF(INDEX(A2:I2, IFERROR(MATCH(2,INDEX(1/(A2:I2<>LOOKUP(2,A2:I2))/(A2:I2<>"")/(A2:I2<>"bye"),0)),0)+1):I2,LOOKUP(2,A2:I2))
 
Upvote 0
Mr. Houdini, you are both a scholar and a gentleman. Your title as Mr. Excel MVP is most warranted. This formula works like a charm. Thanks so very much.

Michael
 
Upvote 0

Forum statistics

Threads
1,214,392
Messages
6,119,254
Members
448,879
Latest member
oksanana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top