Partition of data by a condition & Selectively changing the values of a column

Thanks Ivan.I have solved half of that problem myself and reworded the pending questions.You can see that here