Hi, Lars!
Here's a script that I think does what you're asking on the Big Class dataset in the Sample Data:
Names Default To Here( 1 );
BC_dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
BCSorted_dt = BC_dt << Sort( By( :age, :sex, :height, :weight ), output table name("Big Class Sorted"));
BCSorted_dt << New Column( "Computed Order",
Numeric,
Ordinal,
Formula( If(row()==1 | :age!=Lag(:age, 1), 1, Lag(:Computed Order, 1)+1) ),
EvalFormula);
If all you need is the formula, you can copy the Formula() argument in the script and paste it in the formula editor...just remember to sort the data appropriately first.
Good luck!