如果第一个AVERAGEIFS公式不起作用,如何获取第二个AVERAGEIFS公式进行接管(Google表格)? (使用IFERROR还是SUMPRODUCT?)

时间:2018-08-18 05:46:21

标签: google-sheets excel-formula average

我正在尝试满足AVERAGEIF的一些条件(来自另一张纸: SHEET1 )。如果不满足条件,那么我希望其他AVERAGEIFS公式生效。

不确定如何组合这两个参数。他们自己可以很好地工作,但是如果不满足 Formula 1 的条件,我希望 Formula 2 工作。

我应该使用SUMPRODUCT还是将这些公式嵌套在一起?希望能将这些结合起来提供帮助。


一级方程式

=AVERAGEIFS('SHEET1'!R3:R105, 'SHEET1'!A3:A105, "x", 'SHEET1'!S3:S105, "*EWS*", 'SHEET1'!D3:D105, "SAV", 'SHEET1'!Q3:Q105, ">"&month(today())&"/"&day(today())&"/"&year(Today())-3)

  • 平均范围:R3:R105

    A3:A105 = x

    S3:S105包含EWS

    D3:D105 = SAV

    Q3:Q105过去3年内的日期 <-公式1失败的原因是因为不满足此最后一个条件

如果单元格不符合一级方程式的条件,请激活一级方程式2:

公式2

=AVERAGEIFS('SHEET1'!R3:R105, 'SHEET1'!A3:A105, "x", 'SHEET1'!S3:S105, "*EWS*", 'SHEET1'!D3:D105, "SAV", 'SHEET1'!B3:B105, ">"&month(today())&"/"&day(today())&"/"&year(Today())-3)

  • 平均范围:R3:R105 A3:A105 = x

    S3:S105包含EWS

    D3:D105 = SAV

    B3:B105最近3年内的日期


我尝试了一些尝试,但最终都出错了。有没有办法使用IFERROR函数?我尝试将公式2 替换为value_if_error,但遇到另一个错误。

2 个答案:

答案 0 :(得分:1)

所以尝试:

=iferror(your-ave-1,iferror(your-ave2,"check"))

如果返回“ check”,则您的两个平均计算均无效。引号(“)现在已纠正-智能手机上的字体...

我没有像使用智能手机一样查看您的平均计算。

编辑

更新了公式以包含正确的“

=iferror(Formula 1,iferror(Formula 2,"check"))

取代的公式:

=iferror(AVERAGEIFS('SHEET1'!R3:R105, 'SHEET1'!A3:A105, "x", 'SHEET1'!S3:S105, "*EWS*", 'SHEET1'!D3:D105, "SAV", 'SHEET1'!Q3:Q105, ">"&month(today())&"/"&day(today())&"/"&year(Today())-3),iferror(AVERAGEIFS('SHEET1'!R3:R105, 'SHEET1'!A3:A105, "x", 'SHEET1'!S3:S105, "*EWS*", 'SHEET1'!D3:D105, "SAV", 'SHEET1'!P3:P107, "<>"), "check"))

答案 1 :(得分:0)

尝试:

=IFERROR(ArrayFormula(IF(SHEET1!Q3:Q105 > month(today())&"/"&day(today())&"/"&year(Today())-3,
                         AVERAGEIFS(SHEET1!R3:R105, SHEET1!A3:A105, "x", SHEET1!S3:S105, "*EWS*", SHEET1!D3:D105, "SAV", SHEET1!Q3:Q105, ">"&month(today())&"/"&day(today())&"/"&year(Today())-3),
                         AVERAGEIFS(SHEET1!R3:R105, SHEET1!A3:A105, "x", SHEET1!S3:S105, "*EWS*", SHEET1!D3:D105, "SAV", SHEET1!B3:B105, ">"&month(today())&"/"&day(today())&"/"&year(Today())-3))),)

更新:

=IFERROR(ArrayFormula (IF (SHEET1!Q3:Q105 > month(today())&"/"&day(today())&"/"&year(Today())-3,                       
AVERAGEIFS(SHEET1!R3:R105, SHEET1!A3:A105, "x", 
                           SHEET1!S3:S105, "*EWS*", 
                           SHEET1!D3:D105, "SAV", 
                           SHEET1!Q3:Q105, ">"&month(today())&"/"&day(today())&"/"&year(Today())-3),                      
AVERAGEIFS(SHEET1!R3:R105, SHEET1!A3:A105, "x", 
                           SHEET1!S3:S105, "*EWS*", 
                           SHEET1!D3:D105, "SAV", 
                           SHEET1!B3:B105, ">"&month(today())&"/"&day(today())&"/"&year(Today())-3))),)

enter image description here