Hi,
Lets try this:
Sub HiLowCnt()
Dim cell As Range, rng As Range
Dim prev
Dim hicnt As Integer, locnt As Integer
Set rng = Range(Cells(1, 2), Cells(Rows.Count, 2).End(xlUp))
prev = "Low"
For Each cell In rng
If cell.Offset(0, 1) = "Low" Then
If prev = "Hi" Then
cell.Offset(-hicnt, 3) = "Hi Cnt " & hicnt
hicnt = 0
End If
locnt = locnt + 1
prev = "Low"
ElseIf cell.Offset(0, 1) = "" And prev = "Low" Then
locnt = locnt + 1
ElseIf cell.Offset(0, 1) = "Hi" Then
If prev = "Low" Then
cell.Offset(-locnt, 3) = "Low Cnt " & locnt
locnt = 0
End If
hicnt = hicnt + 1
prev = "Hi"
ElseIf cell.Offset(0, 1) = "" And prev = "Hi" Then
hicnt = hicnt + 1
End If
If prev = "Hi" And cell.Offset(1, 0) = "" Then
cell.Offset(, 3) = "Hi Cnt " & hicnt
hicnt = 0
End If
If prev = "Low" And cell.Offset(1, 0) = "" Then
cell.Offset(, 3) = "Low Cnt " & locnt
locnt = 0
End If
Next cell
End Sub
There are other and better ways, but ......
Charles