Thanks a lot, your inputs were very helpful. I have extended the formula to apply to a larger set of data.

I have utilised Greg's logic.

Regards,
Snehith