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

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
@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,224,827
Messages
6,181,200
Members
453,022
Latest member
RobertV1609

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