In the attached a formula in cell O4, with hints for arguments:

2024-05-29_155905.jpg

This (in Excel 2021) is based on a named *lambda *formula. The name is *Distances* (see *Name Manager* in the *Formulas *tab of the ribbon), its formula is:

=LAMBDA(rng,LowerLimit,LET(a,FILTER(SEQUENCE(ROWS(rng)),rng>=LowerLimit),b,DROP(VSTACK({0},a),-1),a-b-1))

If you don't want to create a named formula you could use this formula directly on the sheet (cell M4) which is:

=LAMBDA(rng,LowerLimit,LET(a,FILTER(SEQUENCE(ROWS(rng)),rng>=LowerLimit),b,DROP(VSTACK({0},a),-1),a-b-1))(I1:I53,D1)

I know it's not in the same format that you asked for but could it be of any use?