1
votes

I am trying to calculate the standard deviation for data points that must meet two conditions. The specific example is: The standard deviation of yields for the crop variety "Z1" in the region "A" have to be calculated. I have a list of several thousand yields with corresponding region and variety. In the table below, there are 3 values that meet this condition (1500, 1800, 1600), so the result should be the standard deviation for these values and all other yields should be ignored.

Region  Variety Yield
A   Z1  1500
B   Z1  2100
B   X2  1900
A   X1  1700
C   Z2  2000
C   X1  1500
A   Z1  1800
B   Z2  2500
C   X1  1700
A   Z1  1600

I tried using this formula, but it does not work (also not as array formula) and only returns "FALSE"

=IF(AND(Region="A",Variety="Z1"),STDEV.S(Yield))

Thank you very much for helping me to solve this!

2
Does this work as an array formula? =STDEV.S(IF(Region="A",IF(Variety="Z1",Yield)))SJR
That worked perfectly! Thank you very much for the quick help!cbr

2 Answers

3
votes

I would say:

=STDEV.S(IF((A2:A11="A")*(B2:B11="Z1"),C2:C11,""))

Array entered.

3
votes

If you have Excel 365, then:

=STDEV.S(FILTER(C:C,(A:A="A")*( B:B="Z1")))

enter image description here