Here's one way - put zero in B1 and this formula in B2:

=IF(A2="",MAX(B$1:B1)+1,IF(ISNUMBER(B1),A2,B1&"|"&A2))

Copy that formula down to the bottom of your data plus one row, so that it ends with a number.

Then you can put this formula in, say, D2:

=IFERROR(INDEX(B:B,MATCH(ROWS($1:1),B:B,0)-1),"")

When you copy this down it will bunch all the results onto consecutive rows, which I thought would be more useful than how you showed it in column C in your sample file. Consequently, you will only need to copy this formula down for as many sections as you have (i.e. the last number that you can see in column B). You can then fix the values in column D and delete the contents of column B.

Hope this helps.

Pete