In cell C2 enter a 1 In cell C3 you can enter the formula
=IF(B3=B2,1+C2,1)
in cell D2 enter the formula
=IF(C3=1,C2,"")
then just drag them down to the end. You will have to manually enter the last figure in column D.