Well spotted! It's never as easy as you think!
In the attached, it all hinges around the adjustment of the formula in cell F3 to get the first
Or no. in a pad.
I've used the same adjustment in cell I3, so that no formula requires helper columns.
As an aside, seeing your small table at N2 (in my attachment) I think you can probably get the information you want more reliably and flexibly by not using a single formula but using a pivot table.
There's a pivot table at cell R3 where you'll see that the first column is created by grouping the
Or No.s. Right-click any of the values in the first column of the pivot and choose
Group… to see the grouping applied. This table gives you the max and min numbers used for each pad - no formulae.
This next bit you can do yourself; add the
Rep field either above or below the
Or No. in the
Rows area of the pivot fields. When you add it above the
Or No. you get data remarkably similar to your table.
The file:
Excel file
(It was a bit too big to attach. Click on the
Download button once the link opens.)