@vince_faller provides a solution that works for your data table in the form after the table has been sorted. I am not sure what it takes to order your data.
Below, is a formula that was developed using the imported Excel file and making no modification to the file once it is imported into JMP.
If( Row() == 1 | :ATT1 != Lag( :ATT1 ),
currATT1 = :ATT1;
currFreq = :FREQUENCY;
currRow = Row();
If( :ATT1 == 0,
theRow = 0,
theRow = (Current Data Table() << get rows where(
Row() > currRow & :ATT1 == currATT1 - 1 & :FREQUENCY == currFreq
))[1] - Row()
);
);
:RESULT - :RESULT[Row() + theRow];
Each time the value of ATT! changes, the formula looks ahead to find the next row where the FREQUENCY is the same as the current FREQUENCY and the ATT! is 1 less than the current value of ATT1 and finds the number of rows between the current row, and the look ahead row. It uses that offset value from that point on, until the value of ATT1 changes again.
Attached is the imported Excel file I used.
Jim