I have attached my file in which i incorporated your formula, its giving me the result i wanted.
Forum Rules