View Full Version : Dynamic Looping Help

06-29-2011, 12:47 PM

Hopefully I can explain exactly what im trying to do in words, however, if not, the please take a look at the attached workbook and hopefully things will become clearer.

On the sheet named "InputData" I have a list of transactions. This is a historic list of transactions in one single account, however, contains multiple difference securities.

In this example I have transactions in security (Sec1, Sec4, Sec2 and Sec9 which are shown in Column D)

I want to loop through each individual security and find out the total quantity as at the 31st December 2010.

The starting row is the first row of that specific security. You then add or subtract the quantity based on if its a Buy or Sell.

I have shown the formula on the Input Example in column M for example purposes only. I need the code to work this out from the starting point of each security.

This is then my starting point in the sheet "ExampleOutput" and is classed as a "Re-Purchase"

Any transactions after the 31st December for that specific security are then carried over aswell.

If there are no transactions before the 31st December 2010 and only after then they are carried over to the output sheet as how they are. (Sec 2 has this example)

If there are no transactions after the 31st December then only the RePurchase transaction is created on the Output sheet. (Sec 9 has this example)

Hope it makes sense and hope someone can help me.
The example workbook should certainly make a lot more sense than my words above.



06-30-2011, 05:14 AM
Is anyone able to give me a nudge in the right direction?