Most Consecutive appearances in a range

ollyhughes1982

Well-known Member
Joined
Nov 27, 2018
Messages
777
Office Version
  1. 365
Platform
  1. MacOS
Hi,

I have the below worksheet (see first image), which lists all of my completed parkruns.

Most Consecutive parkrun Events (Venues) - 1.jpg


What I want to identify from this range (C4:C2003) is which event that I have done the most times consecutively (rather than the most times in total). I have manually calculated the correct figures (highlighted in yellow) for illustration of what I’m trying to achieve. As well as identifying which event it is, I’d also like to show the earliest and latest date for which this consecutive range took place.

On top of those three calculations, I’d also like to populate the second worksheet (see second image, below) with the actual list of the consecutive events, along with their number in the run and the dates. I’m guessing some sort of FILTER function might be needed for this. I've again highlighted in yellow, the manual results I am trying to automate.

Most Consecutive parkrun Events (Venues) - 2.jpg


I'd like to avoid adding any helper columns to these worksheets, if at all possible.

I have added a link to the (small) file, here: https://1drv.ms/x/c/f08b781118912fd2/Ee0-4PthSBBOtjXBxvogX0MBjJ76ECnenE_AJLdZyK_Wmg?e=51q17t

Thanks in advance!

Olly.
 
How about
Excel Formula:
=LET(f,FILTER('All Completed Runs'!C4:E2003,'All Completed Runs'!C4:C2003<>""),v,TAKE(f,,1),s,SCAN(1,DROP(v,-1)=DROP(v,1),LAMBDA(a,b,IF(b,a+1,1))),r,XMATCH(MAX(s),s)+1,HSTACK(SEQUENCE(MAX(s)),INDEX(f,SEQUENCE(MAX(s),,r-MAX(s)+1),{1,3})))
Brilliant thanks so much. Perfect.
 
Upvote 0

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Apologies, one last thing; is there a way I can get the 81 count from the formula (below)? It would be helpful, as I wouldn't then need the helper column.
Excel Formula:
=LET(f,FILTER('All Completed Runs'!C4:E2003,'All Completed Runs'!C4:C2003<>""),v,TAKE(f,,1),s,SCAN(1,DROP(v,-1)=DROP(v,1),LAMBDA(a,b,IF(b,a+1,1))),r,XMATCH(MAX(s),s)+1,HSTACK(SEQUENCE(MAX(s)),INDEX(f,SEQUENCE(MAX(s),,r-MAX(s)+1),{1,3})))
 
Upvote 0
I have used this formula:
Excel Formula:
=COUNT(LET(f,FILTER('All Completed Runs'!C4:E2003,'All Completed Runs'!C4:C2003<>""),v,TAKE(f,,1),s,SCAN(1,DROP(v,-1)=DROP(v,1),LAMBDA(a,b,IF(b,a+1,1))),r,XMATCH(MAX(s),s)+1,HSTACK(SEQUENCE(MAX(s)),INDEX(f,SEQUENCE(MAX(s),,r-MAX(s)+1),{1,3}))))/2

I just added a count and divided by 2. It isn't very pretty, but does work.
 
Upvote 0
You can use
Excel Formula:
=LET(f,FILTER('All Completed Runs'!C4:E2003,'All Completed Runs'!C4:C2003<>""),v,TAKE(f,,1),s,SCAN(1,DROP(v,-1)=DROP(v,1),LAMBDA(a,b,IF(b,a+1,1))),MAX(s))
 
Upvote 0
I have used this formula:
Excel Formula:
=COUNT(LET(f,FILTER('All Completed Runs'!C4:E2003,'All Completed Runs'!C4:C2003<>""),v,TAKE(f,,1),s,SCAN(1,DROP(v,-1)=DROP(v,1),LAMBDA(a,b,IF(b,a+1,1))),r,XMATCH(MAX(s),s)+1,HSTACK(SEQUENCE(MAX(s)),INDEX(f,SEQUENCE(MAX(s),,r-MAX(s)+1),{1,3}))))/2

It isn't very pretty, but does work.

You can use
Excel Formula:
=LET(f,FILTER('All Completed Runs'!C4:E2003,'All Completed Runs'!C4:C2003<>""),v,TAKE(f,,1),s,SCAN(1,DROP(v,-1)=DROP(v,1),LAMBDA(a,b,IF(b,a+1,1))),MAX(s))
Thanks
 
Upvote 0

Forum statistics

Threads
1,223,629
Messages
6,173,434
Members
452,514
Latest member
cjkelly15

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