3-4-21: I've edited the initial post trying to make it clearer, sorry for the misleading information.
I have a spreadsheet with the results of a fantasy football league and I'm trying to calculate some statistics. I'm currently struggling with a formula to calculate the maximum number of consecutive days that each team was leader for each season.
Seasons span from 2015-16 to 2019-20 (for the time being) and the number of teams participating is not fixed (sometimes 8, others 10), as the number of Groups (sometimes 1, others 2). In column "C" I have the name of the Team (the "Team interval" for each season is calculated in column "F") and in column "E" I've calculated the ranking for each Day of each season (the interval for each Season used for ranking is calculated in column "G").
Maybe with the following simplified example I'll explain myself better. Team 2 has been the leader for 11 consecutive days (Days 1 to 11) and then for another 13 consecutive days (Days 13 to 25). Team 5 has been the leader for 11 consecutive days (Days 26 to 36). In column "I" the manually typed result that I'd expect. In column "J" a partially working formula using the variable interval with INDIRECT, which however doesn't take into account the team and counts 24 consecutive days (Day 13 to 36) instead of 13 for Team 2 and 11 for Team 5 separately.
It looks like only the last step is missing and I've tried modifying the formula by adding a condition at the bottom on the Team interval column ("F"), but it doesn't work