Please bear with me as i try to explain what i am looking for. I am trying to calculate something called crush. 1 complete fill is when there are a quantity of 10 "ZS", 9 "ZL", and 11 "ZM". I am trying to create a template so when an order is complete, i will be able to copy and paste a summary into the sheet and it will be able to calculate the crush formula every time the price of "ZS" changes (only focus on "Real Price" the trading platform uses shortcuts so i made a formula to fix this). The hard part is that it is dynamic data. And it isnt always as pretty as completing 1 crush at 10,9,11 quantity. So i need the formula to also calculate the average of ZS,ZL,ZM prices since previous calculation and when the running total of ZS quantity hits another multiple of 10 to calculate crush. In this example crush will be calculated at I9, I12, I17, I20, and I23. Let me know if you need clarification as i expect it. Thank you in advance!
Excel 2012 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | |||
8 | Order ID | Contract | Price | BuySell | OrderType | Quantity | OakTimeInForce | Real Price | Crush @ fill | ||
9 | 25496771 | ZS | 10652 | Buy | LMT | 10 | GTC | 10652.5 | 122.8 | ||
10 | 25496771 | ZL | 3124 | Sell | LMT | 9 | GTC | 3124 | |||
11 | 25496771 | ZM | 3838 | Sell | LMT | 11 | GTC | 3838 | |||
12 | 25496771 | ZS | 10680 | Buy | LMT | 10 | GTC | 10680 | Calculate | ||
13 | 25496771 | ZL | 3124 | Sell | LMT | 9 | GTC | 3124 | |||
14 | 25496771 | ZM | 3838 | Sell | LMT | 11 | GTC | 3838 | |||
15 | 25496771 | ZS | 10676 | Buy | LMT | 1 | GTC | 10677.5 | |||
16 | 25496771 | ZS | 10680 | Buy | LMT | 7 | GTC | 10680 | |||
17 | 25496771 | ZS | 10682 | Buy | LMT | 2 | GTC | 10682.5 | Calculate | ||
18 | 25496771 | ZL | 3124 | Sell | LMT | 9 | GTC | 3124 | |||
19 | 25496771 | ZM | 3838 | Sell | LMT | 11 | GTC | 3838 | |||
20 | 25496771 | ZS | 10692 | Buy | LMT | 10 | GTC | 10692.5 | Calculate | ||
21 | 25496771 | ZL | 3115 | Sell | LMT | 9 | GTC | 3115 | |||
22 | 25496771 | ZM | 3830 | Sell | LMT | 11 | GTC | 3830 | |||
23 | 25496771 | ZS | 10694 | Buy | LMT | 10 | GTC | 10695 | Calculate | ||
24 | 25496771 | ZL | 3115 | Sell | LMT | 9 | GTC | 3115 | |||
25 | 25496771 | ZM | 3830 | Sell | LMT | 11 | GTC | 3830 | |||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
H9 | =IF(B9=$C$1,C9,IF(B9=$B$1,C9,IF(B9=$D$1,IF(RIGHT(C9,1)+0=4,C9+1,IF(RIGHT(C9,1)+0=6,C9+1.5,IF(RIGHT(C9,1)+0=2,C9+0.5,IF(RIGHT(C9,1)+0=0,C9))))))) | |
I9 | =((C10*0.11)+(C11*0.22)-C9*0.1) |