Thanks Excel Fox,
But what i need is the output should be like in Col I to Col O, sorry i wasn't able to explain it well.

The logic is to check the first row with value in col B and lookup the next value in col C up to the last value which Col C is not available in Col B.

br,