Count longest streak

droot

New Member
Joined
Oct 18, 2018
Messages
36
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a large dataset and I'm trying to count the longest streak (consecutive years) for the individual for a specific country and sport.
I have no idea how to approach this so any help will be greatly appreciated.

Thanks in advance.

Example data (streak column shows the expected answer) -

YearCountrySportNamestreak
2012​
AustraliaFootballAlan
2013​
AustraliaFootballAlan
2014​
AustraliaFootballAlan
2015​
AustraliaFootballAlan
2016​
AustraliaFootballAlan
2017​
AustraliaFootballAlan
6​
2018​
AustraliaHockeyAlan
2019​
AustraliaHockeyAlan
2020​
AustraliaHockeyAlan
3​
2019​
ChinaTennisAlex
2020​
ChinaTennisAlex
2​
2008​
BrazilHockeyBrian
1​
2013​
United KingdomFootballJohn
2014​
United KingdomFootballJohn
2015​
United KingdomFootballJohn
2017​
United KingdomFootballJohn
2018​
United KingdomFootballJohn
2019​
United KingdomFootballJohn
2020​
United KingdomFootballJohn
4​
2020​
AustraliaTennisDaniel
1​
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
@droot
Assuming you require a formula solution?
The below requires a 'Helper' column which you can hide. As to it's speed / efficiency on your large dataset, I cannot say.

Book1
ABCDEF
1YearCountrySportNamestreakHelper
22012AustraliaFootballAlan 1
32013AustraliaFootballAlan 2
42014AustraliaFootballAlan 3
52015AustraliaFootballAlan 4
62016AustraliaFootballAlan 5
72017AustraliaFootballAlan66
82018AustraliaHockeyAlan 1
92019AustraliaHockeyAlan 2
102020AustraliaHockeyAlan33
112019ChinaTennisAlex 1
122020ChinaTennisAlex22
132008BrazilHockeyBrian11
142013United KingdomFootballJohn 1
152014United KingdomFootballJohn 2
162015United KingdomFootballJohn33
172017United KingdomFootballJohn 1
182018United KingdomFootballJohn 2
192019United KingdomFootballJohn 3
202020United KingdomFootballJohn44
212020AustraliaTennisDaniel11
22  
Sheet16


Select E2 & F2 to expose the formulas.
Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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