Calculation every time a lookup value changes

C_merr

New Member
Joined
May 26, 2016
Messages
19
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
ABCDEFGHI
8Order IDContractPriceBuySellOrderTypeQuantityOakTimeInForceReal PriceCrush @ fill
925496771ZS10652BuyLMT10GTC10652.5122.8
1025496771ZL3124SellLMT9GTC3124
1125496771ZM3838SellLMT11GTC3838
1225496771ZS10680BuyLMT10GTC10680Calculate
1325496771ZL3124SellLMT9GTC3124
1425496771ZM3838SellLMT11GTC3838
1525496771ZS10676BuyLMT1GTC10677.5
1625496771ZS10680BuyLMT7GTC10680
1725496771ZS10682BuyLMT2GTC10682.5Calculate
1825496771ZL3124SellLMT9GTC3124
1925496771ZM3838SellLMT11GTC3838
2025496771ZS10692BuyLMT10GTC10692.5Calculate
2125496771ZL3115SellLMT9GTC3115
2225496771ZM3830SellLMT11GTC3830
2325496771ZS10694BuyLMT10GTC10695Calculate
2425496771ZL3115SellLMT9GTC3115
2525496771ZM3830SellLMT11GTC3830
Sheet1
Cell Formulas
RangeFormula
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)
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
If i could talk to excel formula i would try to say...
IF(ZS "real price" is different from previous ZS contract, Averageif(real price,if contract is ZS, CalculatedWhen(the running total of ZS quantity reaches its next multiple of 10

If that makes any sense

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,214,629
Messages
6,120,630
Members
448,973
Latest member
ChristineC

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top