I got the answer in the other forum. This
=IF(COUNTIF($B$1:$B1,"=1")-COUNTIF($B$1:$B1,"=2")=0,IF(A2<-0.1,1,""),IF(COUNTIF($B$1:$B1,"=1")-COUNTIF($B$1:$B1,"=2")=1,IF(A2-0.1>= INDEX($A$1:$A1,SUMPRODUCT(MAX(ROW($B$1:$B1)*($B$1:$B1=1)))),2,"")))
and this
Sub MG07Jun52
Dim Rng As Range, Dn As Range, Num As String
Set Rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
For Each Dn In Rng
If Num = "" Then
If Dn.Value < -0.1 Then
Dn.Offset(, 1) = 1
Num = Dn.Value
End If
ElseIf Not Num = "" Then
If Dn.Value >= Num + 0.1 Then
Dn.Offset(, 1) = 2
Num = ""
End If
End If
Next Dn
End Sub
Bookmarks