Formula to create consecutive wins/losses

James8761

Board Regular
Joined
Apr 24, 2012
Messages
156
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I'm working on trying to produce some stats for a football league I help run. As the results come in I just put a W or a L against the team name to show if they won or lost. The data is in columns F2:G1255. An example is show below.

I want to create a formula that shows the most amount of consecutive losses "L" a team has had. The answer I would want for Baystown in the example shown would be 4.

Then I need to create a formula for the most amount of consecutive Wins "W" a team has had. The answer I would want for Globe in the example shown would be 3.

Does anyone know if the above formulas are possible please?

Kind regards,
James

[TABLE="width: 156"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]Baystown[/TD]
[TD]L[/TD]
[/TR]
[TR]
[TD]Globe[/TD]
[TD]W[/TD]
[/TR]
[TR]
[TD]North Shields[/TD]
[TD]L[/TD]
[/TR]
[TR]
[TD]Eastbridge[/TD]
[TD]W[/TD]
[/TR]
[TR]
[TD]Baystown[/TD]
[TD]L[/TD]
[/TR]
[TR]
[TD]Baystown[/TD]
[TD]L[/TD]
[/TR]
[TR]
[TD]North Shields[/TD]
[TD]W[/TD]
[/TR]
[TR]
[TD]Eastbridge[/TD]
[TD]W[/TD]
[/TR]
[TR]
[TD]Globe[/TD]
[TD]W[/TD]
[/TR]
[TR]
[TD]Globe[/TD]
[TD]W[/TD]
[/TR]
[TR]
[TD]North Shields[/TD]
[TD]L[/TD]
[/TR]
[TR]
[TD]Baystown[/TD]
[TD]L[/TD]
[/TR]
[TR]
[TD]Baystown[/TD]
[TD]W[/TD]
[/TR]
[TR]
[TD]Globe[/TD]
[TD]L[/TD]
[/TR]
[TR]
[TD]Globe[/TD]
[TD]W[/TD]
[/TR]
[TR]
[TD]North Shields[/TD]
[TD]W[/TD]
[/TR]
[TR]
[TD]Eastbridge[/TD]
[TD]L[/TD]
[/TR]
[TR]
[TD]Eastbridge[/TD]
[TD]W[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Try


[Table="class: grid"][tr][td="bgcolor: #DCE6F1"][/td][td="bgcolor: #DCE6F1"]
F
[/td][td="bgcolor: #DCE6F1"]
G
[/td][td="bgcolor: #DCE6F1"]
H
[/td][td="bgcolor: #DCE6F1"]
I
[/td][td="bgcolor: #DCE6F1"]
J
[/td][td="bgcolor: #DCE6F1"]
K
[/td][/tr]
[tr][td="bgcolor: #DCE6F1"]
1
[/td][td]
Team​
[/td][td]
Result​
[/td][td][/td][td]
Team​
[/td][td]
L or W?​
[/td][td]
Formula​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
2
[/td][td]
Baystown​
[/td][td]
L​
[/td][td][/td][td]
Baystown​
[/td][td]
L​
[/td][td]
4​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
3
[/td][td]
Globe​
[/td][td]
W​
[/td][td][/td][td]
Globe​
[/td][td]
W​
[/td][td]
3​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
4
[/td][td]
North Shields​
[/td][td]
L​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
5
[/td][td]
Eastbridge​
[/td][td]
W​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
6
[/td][td]
Baystown​
[/td][td]
L​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
7
[/td][td]
Baystown​
[/td][td]
L​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
8
[/td][td]
North Shields​
[/td][td]
W​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
9
[/td][td]
Eastbridge​
[/td][td]
W​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
10
[/td][td]
Globe​
[/td][td]
W​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
11
[/td][td]
Globe​
[/td][td]
W​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
12
[/td][td]
North Shields​
[/td][td]
L​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
13
[/td][td]
Baystown​
[/td][td]
L​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
14
[/td][td]
Baystown​
[/td][td]
W​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
15
[/td][td]
Globe​
[/td][td]
L​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
16
[/td][td]
Globe​
[/td][td]
W​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
17
[/td][td]
North Shields​
[/td][td]
W​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
18
[/td][td]
Eastbridge​
[/td][td]
L​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
19
[/td][td]
Eastbridge​
[/td][td]
W​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
20
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]


Criteria in columns I:J

Array formula in K2 copied down
=MAX(FREQUENCY(IF(F$2:F$1255=I2,IF(G$2:G$1255=J2,ROW(G$2:G$1255)-ROW(G$2)+1)),IF(F$2:F$1255=I2,IF(G$2:G$1255<>J2,ROW(G$2:G$1255)-ROW(G$2)+1))))
confirmed with Ctrl+Shift+Enter, not just Enter

Hope this helps

M.
 
Upvote 0
Thanks so much for this, Marcelo. It's great, does exactly what I want.
 
Upvote 0

Forum statistics

Threads
1,224,072
Messages
6,176,213
Members
452,715
Latest member
DebbieCox

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