Referencing a predecessor row in a formula


I want to compare the column value in a current row to the column value in a prior row. I want to write a formula that is the equivalent of:

if (row() = 1,1,if(row()=row(-1),2,3)

The @row formulation doesn't take an argument and there is no equivalent to the ROW() function n Excel. The PARENT, CHILDREN functions do this for a hierarchy but all I want to do is reference the current row number and the prior row number.

Relative references should work: if(data2=data1,2,3) but when I sort my data the row references are changed to reflect their new sort position and no longer just reference the previous row.

This seems so basic I'm sure I'm missing something.

Thanks for any help


Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!