How to Use CountIfs to Calculate a Running Total.
I was trying to configure this code:
=IF(
'Enter up to 10x Legs/Strategy - Tied to 10x BSM Banks'::$D$5 = "N/A",
"",
IF(
OR(
'Enter up to 10x Legs/Strategy - Tied to 10x BSM Banks'::$D$5 = "LC",
'Enter up to 10x Legs/Strategy - Tied to 10x BSM Banks'::$D$5 = "SC",
'Enter up to 10x Legs/Strategy - Tied to 10x BSM Banks'::$D$5 = "LP",
'Enter up to 10x Legs/Strategy - Tied to 10x BSM Banks'::$D$5 = "SP",
'Enter up to 10x Legs/Strategy - Tied to 10x BSM Banks'::$D$5 = "LA",
'Enter up to 10x Legs/Strategy - Tied to 10x BSM Banks'::$D$5 = "SA"
),
I4,
0
)
) / COUNTIFS(
'Enter up to 10x Legs/Strategy - Tied to 10x BSM Banks'::$D$5:$D$14, "<>N/A",
ROW('Enter up to 10x Legs/Strategy - Tied to 10x BSM Banks'::$D$5:$D$14) <= ROW('Enter up to 10x Legs/Strategy - Tied to 10x BSM Banks'::$D$5),
ROW('Enter up to 10x Legs/Strategy - Tied to 10x BSM Banks'::$D$5:$D$14) - ROW('Enter up to 10x Legs/Strategy - Tied to 10x BSM Banks'::$D$5) + 1
)
But get an error:
COUNTIFS requires that all range arguments are the same size.I am trying to calculate a running total of breakeven values for my 10 x Leg calculator and figuring out how to code it.
I have a dropdown menu (in rows 'Enter up to 10x Legs/Strategy - Tied to 10x BSM Banks'::$D$5:$D$14) that can select whether any trades are valid or non positions.
So any one of the 10 trades could be a valid trade i.e. an option/asset (LC, SC, LP, SP, LA, SA) or a non trade (N/A) where no position is taken (i.e you’re ”flat”).
If it is the former, (i.e. a valid trades, LC, SC, LP, SP, LA, SA), then the b/even values are a simple case of adding up all the current running total valid Legs b/even values and dividing the current total breakeven value by the number of valid trades (LC, SC, LP, SP, LA, SA) but only up to the last current b/even value, — eg in Leg 4, — because Legs 5 to 10 could be already set to N/A and I don’t want those non 0.00 b/even trades (F8), counted as part of the denominator for the running b/even totals.
So in the image Leg 1’s b/even value of 11500 is to be counted, as is Leg 2’s, but not Leg 3 (0.00), but it needs to include Leg 4 (12100), so the total is 11500 +11500 +12100 but divided by 3 Legs not 4, 35,100/3 = 11,700.
Any help would be gratefully appreciated,
Cheers.
MacBook Pro 15″, macOS 12.3