I have attached the sheets.first tab the original data and in the second tab the required end result is showing.