Hi ,
With just one row of data , and the explanation , I doubt that everything will be clear.
If you can have data of at least 10 rows , with enough variety to cover all the cases , and if you can work out manually what the output should be in a few cases , it may be clear.
I think the following need to be explained in more detail :
Narayan
Narayan