The thing is offcourse that not all cells are filled from the column
Think you are talking of what I call “compacting”. The attached example does it using a few helpers.
The logical order is Input: A > E > F > G > C :Result .
A couple of options added to the nice Lupp sample, without using formula, with Pivot Table and Standard Filter.
SimpleCompactingExample with Pivot Table and Standard Filter