A few ways to skin this cat.
Avoiding macros and using a dynamic range...
I used column F as my 'change detector'. In my case, I put a 1 in the cell if 'the change occurred'. Note that the first cell in the column F range needs to be a 1.
Next, with cell H1 selected I went to Name Manager and created this
Name: myrng
Formula: =OFFSET($B$1,MAX(ROW($F$1:$F1)*($F$1:$F1))-1,0,ROW()-MAX(ROW($F$1:$F1)*($F$1:$F1))+1,4)
Then in H1:
=countif(myrng, b1)
Bookmarks