带有OR的Excel AVERAGEIFS

时间:2018-11-12 20:46:14

标签: excel

当前具有AVERAGEIFS公式,其中:

<f:layout>
          <f:ResponsiveGridLayout
           labelSpanXL="4" labelSpanL="4" labelSpanM="4" labelSpanS="4"
           emptySpanXL="1" emptySpanL="1" emptySpanM="1" emptySpanS="1"
           columnsXL="2" columnsL="2" columnsM="2"
           singleContainerFullSize="false" />
 </f:layout>

公式粘贴在下面:

FormContainer

当前,该公式仅考虑<f:FormElement> <f:fields> <Label text="text"> </Label> <Text text="label"> <layoutData> <l:GridData span="XL1 L4 M5 S4" /> </layoutData> </Text> </f:fields> </f:FormElement> Col A is Arrival to Last Lab Results (POC Glu, POC INR) with the data being numbers Col B is Activation Type in this case being "EMS (pre-hospital)" Col C is poc_inr not needed which is either "Yes" or "No" The formula is applied for a date range of 1 month. 的情况,我想找到一种方法来合并OR语句,如果=AVERAGEIFS(MM[Arrival to Last Lab Results (POC Glu, POC INR)], MM[Arrival Date/Time],">="&A30,MM[Arrival Date/Time],"<="&B30,MM[Activation Type],"EMS (pre-hospital)", MM[poc_inr not needed], "Yes") [poc_inr not needed],那么该公式将继续采用Col A中的值,但是如果"Yes."[poc_inr not needed],该公式将改为查看另一列中的值(为简单起见,将其命名为Col D)并向我提供取自Col A和Col D的所有数值的平均值。所有其他条件和条件范围保持不变。

我听说AVERAGEIFS不允许使用OR函数,所以我想知道是否有人有解决此问题的解决方案/替代方法?

1 个答案:

答案 0 :(得分:0)

不要使用OR,为每种情况指定不同的条件,而只需将它们加在一起即可。使用SUMPRODUCT和命名范围/表会更好,使公式更易于阅读:

enter image description here

您应该能够进行调整,而不会遇到很多问题:

 =(SUMPRODUCT((Table1[poc_inr]="Yes")*(Table1[Arrival]>=G2)*(Table1[Arrival]<=H2)*Table1[Last Lab Results])+SUMPRODUCT((Table1[poc_inr]="No")*(Table1[Arrival]>=G2)*(Table1[Arrival]<=H2)*Table1[Other result]))
 /(SUMPRODUCT((Table1[poc_inr]="Yes")*(Table1[Arrival]>=G2)*(Table1[Arrival]<=H2))+SUMPRODUCT((Table1[poc_inr]="No")*(Table1[Arrival]>=G2)*(Table1[Arrival]<=H2)))