Thanks a lot bo_ry for the formulas,

almost solved if any thing else required in this query i can revert back to you.

Thanks again.