'How to move empty cells to the top in excel along with other columns

I have an excel sheet like :

enter image description here

I want to move the blank cells to top but keeping the corresponding column value intact
So the above should get converted to
   name-2
   name-5
   name-6
1 name-1
3 name-3
4 name-4
7 name-7



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source