I have a two part question. I am trying to change the value of previous rows in a column based on data in another column and I'm having a couple of problems. In the example below, when the status changes from Status1 to anything else (note green cells), I want to change the value of the cell 6 rows up (red cell).

The column formula I am using is below.

As you can see from the table, the script does insert a 99 in Row()-6 but there is also a 99 in Row(). I can't figure out where that last one is coming from.
The larger problem I'm trying to solve here is that I want to fill in all cells at and above the status change with 99 (So Row(), Row()-1, Row()-2, ... , Row()-6 all are 99). I tried to use a FOR loop to do this (see second script below) but it does nothing.

As I'm sure you can tell, I'm pretty ignorant regarding JSL so any assistance on this would be greatly appreciated. Thanks much.