May be this in B2 Cell?
In B2 Cell
Formula:=IF(LEFT(TRIM(A2),2)<>"--",MAX($B$1:B1)+1,B1)
Drag it down.. and copy the Column-B formula cells and paste it as values.
Now apply sorting by selecting Column-B as first criteria and Colum-A as second criteria.
Bookmarks