Using Col Cumulative Sum() is one option
Col Cumulative Sum(1, :Sample, :Test)
Col Rank() is also an option
Col Rank(:Sample, :Sample, :Test)
Full example with your table
Names Default To Here(1);
dt = New Table("Untitled 2",
Add Rows(10),
Compress File When Saved(1),
New Column("Sample",
Character,
"Nominal",
Set Values({"A", "A", "A", "A", "B", "B", "C", "C", "C", "C"})
),
New Column("Test",
Character(16),
"Nominal",
Set Values({"one", "one", "two", "two", "one", "two", "one", "one", "two", "two"})
),
New Column("Run Number",
Numeric,
"Continuous",
Format("Best", 12),
Set Values([1, 2, 1, 2, 1, 1, 1, 2, 1, 2])
)
);
dt << New Column("RN", Numeric, Ordinal, Formula(
Col Cumulative Sum(1, :Sample, :Test)
));
-Jarmo