ExampleWB.xlsx
My apologies for poor description, in short i have no idea what function(s) will resolve my requirement so the best i can do is explain (and hope). Ive also done a mock up WB (attached) to illustrate further the problem at hand. Here we go...

So whenever we receive an invoice from a subcontractor we record the transaction in my 'Subcontractors'! sheet on my WB. Each transaction (invoice received) occupies its own unique row in the table.

As a contractor i have a responsibility to deduct tax from subcontractor invoices on a monthly basis (the actual time periods can be found on the ExampleWB attached) Upon doing this i generate a tax statement to supply to the subcontractor showing all deductions made during this period. Each statement has a 'statement number'. Now where it gets tricky, some subcontractors may send multiple invoices in the same period but the tax statement has to account for all of that particular subcontractors invoices in one statement. So on occasion multiple invoice transactions to the same contractor in the same period have to be manually labelled with the same tax statement number example '1001'

I have no problem on the statement side of things because i simply label a cell in my statement template with the statement number i want to generate (example 1001) and then simply use a SUMIF function to look at the 'Subcontractors'! sheet look for all transactions labelled '1001' and it returns the totals of all relevant invoices required to the relevant cells in the statement. This completes my whole statement simply by entering the Statement number. Fine no problem.

My problem is, based on the quantity of invoices we receive and because we enter them as we receive them, it can be not only time consuming but leaves potential for error when me 'manually assign' the statement numbers to each record. Typical example being, we could assign the wrong statement number because we may not check/read the date correctly (other errors of course possible when doing this) So i think i need an array formula or something similar to automate this 'labeling'

As mentioned I've attached a example WB with a breakdown to further help. This may be an impossible request, but i thought id put the challenge out there anyhow.

I thank anyone in advance who at least takes the time to take a look at this, and lots of respect to anyone that has any advice for me regarding this.

If i can help in any way please don't hesitate to ask.

Thank you.