You must provide the exact inputs and expected output so it will be easy for us to solve your query.
Same query with little info was created earlier :-
So do one thing that elaborate your topic here more & give inputs and expected output in Notepad/word doc.
Happy Automation
Best Regards
Er Pratik Wavhal