Formula every time a running total column has a multiple of 10

C_merr

New Member
Joined
May 26, 2016
Messages
19
I need help trying to figure out how to get calculate the average price of ZS every time the quantity column reaches a multiple of 10 (running total) for corresponding ZS rows only. In this example calculate average price of ZS at I9,I12,I17, I20(only the first a quantity of 2 from that price so that it will complete the multiple of 10), I23. I would only like the calculation to occur if it is not going to be the same value as the calculation the previous quantity of 10. (Only focus on the "Real price" not the "Price" because the software that gives out the summary that paste into this template shortcuts prices for ZS so i made a formula to change that back.) Thanks in advance!


Excel 2012
BCDEFGHI
8ContractPriceBuySellQuantityReal PriceCrush @ fill
9ZS10652Buy1010652.5122.8
10ZL3124Sell93124
11ZM3838Sell113838
12ZS10680Buy1010680Calculate
13ZL3124Sell93124
14ZM3838Sell113838
15ZS10676Buy110677.5
16ZS10680Buy710680
17ZS10682Buy1210682.5calculate
18ZL3124Sell93124
19ZM3838Sell113838
20ZS10692Buy1010692.5calculate
21ZL3115Sell93115
22ZM3830Sell113830
23ZS10694Buy1010695calculate
24ZL3115Sell93115
25ZM3830Sell113830
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)))))))
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Excel 2010
BCDEFGHIJK
1ContractPriceBuySellQuantityReal PriceCrush @ fill
2ZS10652Buy1010652.5122.8calculate
3ZL3124Sell93124
4ZM3838Sell113838
5ZS10680Buy1010680Calculatecalculate
6ZL3124Sell93124
7ZM3838Sell113838
8ZS10676Buy110677.5
9ZS10680Buy710680
10ZS10682Buy1210682.5calculatecalculate
11ZL3124Sell93124
12ZM3838Sell113838
13ZS10692Buy1010692.5calculatecalculate
14ZL3115Sell93115
15ZM3830Sell113830
16ZS10694Buy1010695calculatecalculate
17ZL3115Sell93115
18ZM3830Sell113830
Sheet5
Cell Formulas
RangeFormula
K2=IF(B2<>"ZS","",IF(MOD(SUMIF($B$2:B2,"ZS",$F$2:F2),10)=0,"calculate",""))


(we can change the first row if you want)
 
Last edited:
Upvote 0
That's great! one more criteria i was looking for on the formula is for it to not calculate if the "real price" is the same as it was in the previous row that it calculated. is that an easy tweak on this formula?
 
Upvote 0
Something like this depending on what goes in K2:


Excel 2010
ABCDEFGHIJK
1ContractPriceBuySellQuantityReal PriceCrush @ fill
2ZS10652Buy1010652.5122.8x
3ZL3124Sell93124 
4ZM3838Sell113838
5ZS10680Buy1010680Calculatecalculate
6ZL3124Sell93124
7ZM3838Sell113838
8ZS10676Buy110677.5
9ZS10680Buy710680
10ZS10682Buy1210682.5calculatecalculate
11ZL3124Sell93124
12ZM3838Sell113838
13ZS10692Buy1010692.5calculatecalculate
14ZL3115Sell93115
15ZM3830Sell113830
16ZS10694Buy1010695calculatecalculate
17ZL3115Sell93115
18ZM3830Sell113830
Sheet5
Cell Formulas
RangeFormula
K3=IF(LOOKUP(2,1/($K$1:K2<>""),$H$1:H2)=H3,"",IF(B3<>"ZS","",IF(MOD(SUMIF($B$2:B3,"ZS",$F$2:F3),10)=0,"calculate","")))
 
Upvote 0

Forum statistics

Threads
1,215,407
Messages
6,124,723
Members
449,184
Latest member
COrmerod

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