Hey guys
I'm trying to write a macro that will cycle through a large data table, and build a summary table from that would work like this:
Date | B/S | Quant | Price
14/4 | B | 1 | 1
14/4 | B | 2 | 2
14/4 | S | 1 | 4
14/4 | S | 1 | 1
14/4 | B | 3 | 1
15/4 | B | 1 | 1
Would become:
Date | B/S | Quant | Price
14/4 | B | 4 | 1
14/4 | S | 1 | 1
14/4 | B | 2 | 2
14/4 | S | 1 | 4
15/4 | B | 1 | 1
Basically I want the total quantity of the same price bought, or sold, on the same day.
I assume the method would follow something like:
1. Cycle through the prices, and when a unique price is found, note the b/s, the date and the quantity.
2. When the same price is found, if the b/s and date are the same, add the quantity. Continue through list. Else Start again, from 1 below.
4. When for next price, cycle through above prices and if same price found again, move on.
3. Go until there isnt a value (ie reached end)
Here is my attempt, first error i get is the "Next i" after the if statement doesnt work. Dont want to use break though as I just want to move on to next i.
Thanks!
Bookmarks