Using Tables: Apply formulas to columns to create a custom sequence based on rowIndex

Is it possible to create what I am calling a sequence using the rowIndex? For example, lets say a table has 100 rows. I created a new column called Sequence. Then for each set of 10 rows I want to determine a subsequent sequence that would follow the following rules:

rows 1-10 the sequence = 1
rows 11-20 the sequence = 2
rows 21-30 the sequence = 3
this concept continues looping until the end of the data set

I technically have this working but I want it to be more universal without having to account for the dataset size. Below is my current row formula:

if (rowIndex <=10) {
columns['Sequence'] = 1;
} else {
if (rowIndex > 10 && rowIndex <= 20) {
columns['Sequence'] = 2;
} else {
if (rowIndex > 20 && rowIndex <= 30) {
columns['Sequence'] = 3;
} else {
if (rowIndex > 30 && rowIndex <= 40) {
columns['Sequence'] = 4;
}
}
}
}

Comments