来自 IF 的 Google Sheets 数组错误不能在公式下方的行中包含任何内容

问题描述 投票:0回答:1

解决了第一个问题,但还有一个小问题

下面的代码修复了我的错误,但如果下拉菜单设置为 100% 和学生姓名,我需要它返回“全选”。

=IF(B31 = "全部", IF(D31 = '主数据'!AC1, FILTER({'主数据'!AC2:AC, '主数据'!AF2:AF, '主数据'!AH2:AH, '主数据'!AI2:AI}, '主数据'!AC2:AC <>“” ), IF(ISNUMBER(MATCH(D31, '主数据'!AC2:AC, 0)), FILTER({'主数据'!AC2:AC, '主数据'!AF2:AF, '主数据'!AH2:AH, '主数据'!AI2:AI}, '主数据'!AC2:AC = D31 ), “选择学生姓名” ) ), 如果(B31=“<100%", FILTER({'Master Data'!AC2:AC, 'Master Data'!AF2:AF, 'Master Data'!AH2:AH, 'Master Data'!AI2:AI}, ('Master Data'!AI2:AI < 1) * (NOT(ISBLANK('Master Data'!AC2:AC))) ), "Invalid selection for B31" ) )

我正在 Google 表格中创建仪表板。我有以下公式来过滤列表。一切正常,除了。 B31=“<100%". When B31 = "<100%" and D31 is = 'Master Data'!AC1 it will only correctly return if there is nothing in any rows below it for the entire page. I need to be able to leave the end open as the data could change, and I need to be able to add those new rows of data without having to change the code. Every other part of this code works fine and returns the list even if something is in the rows below it as long as it is not in the range of the returning values. I have tried so many workarounds and am a total novice at this. Help me understand why it is only this part of the code that is returning this error, but the other parts of the code are not affected by the rows below having data. Can this be fixed?

抱歉,我无法分享该表,因为它包含学生信息。

=IF(
    B31 = "All",
    IF(
        D31 = 'Master Data'!AC1,
        FILTER(
            {'Master Data'!AC2:AC, 'Master Data'!AF2:AF, 'Master Data'!AH2:AH, 'Master Data'!AI2:AI},
            'Master Data'!AC2:AC <> ""
        ),
        IF(
            ISNUMBER(MATCH(D31, 'Master Data'!AC2:AC, 0)),
            FILTER(
                {'Master Data'!AC2:AC, 'Master Data'!AF2:AF, 'Master Data'!AH2:AH, 'Master Data'!AI2:AI},
                'Master Data'!AC2:AC = D31
            ),
            "Select a student name"
        )
    ),
    IF(
        B31 = "<100%",
        IF(
            D31 = 'Master Data'!AC1,
            FILTER(
                {'Master Data'!AC2:AC, 'Master Data'!AF2:AF, 'Master Data'!AH2:AH, 'Master Data'!AI2:AI},
                'Master Data'!AI2:AI < 1
            ),
            "Select 'All' to filter by student name"
        ),
        "Invalid selection for B31"
    )
)

我尝试了多种方法来修复代码并以相同的结果测试该部分代码,使用镜头和辅助行没有帮助并显示不匹配的行。即使是最基本的版本也可以过滤 <100% creates the same problem.

这是我的电子表格的链接。代码位于第一页。季度出勤下方左侧的第三部分。两个下拉菜单是全部/100% 和学生姓名/姓名列表。第二页是主数据页,它从其他页面提取信息,这些页面将包含来自下载的电子表格的数据,这些数据将发生变化。我无法控制要下载的数据,因此这是适应标头更改/列更改的解决方法。数据页面上的每一列都链接到不同的页面,通过更改数据页面上的第一行,我可以调整它从页面上提取的列。我不确定这些是否会影响我当前的代码,所以我想我会提到它。

google-sheets google-sheets-formula
1个回答
0
投票

尝试:

=LET(r, CHOOSECOLS('Master Data'!AC2:AI,1,4,6,7), n, INDEX(r,,1), p, INDEX(r,,4),
 IFERROR(FILTER(r, IF(B31="All", n<>"", p<1), 
 IF(ISNUMBER(MATCH(D31, n, )), n=D31, n<>"")), "no data for this selection"))

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.