The first question can be solved as: =COUNTIF(B$1:B1; B1) (paste to A1 and fill the column)
=COUNTIF(B$1:B1; B1)
Count all occurrences of the thing in the neighboring cell starting from row 1 ($1) to the current row.
$1