Newbie? We have all been newbies at one time or another. You have come to the right place!
Can you provide some sample data that fits your situation as I describe in this post?
Also, along with your test data mock up in Excel your expected result.
Noel