Google Sheets - 具有动态范围的 countif

发布于 2025-01-21 01:56:04 字数 814 浏览 1 评论 0原文

sheet1 中有一列包含 ID 列表,每个 ID 都有一组状态:

ID  Apr   May      Jun
1   Load  Load     Complete
2   Load  Complete NA
3   Load  Load     Load

在单独的工作表sheet2 中,我有一个 ID 列表,我试图显示其中哪些是完整的。我的想法是使用 address 函数将 countif 与动态单元格范围结合使用:

=countif("'sheet1'!"&address(row(index('sheet1'!$A$1:$A$5,match(A2,'sheet1'!$A$1:$A$5,0),1)),3)&":"&ADDRESS(row(index('sheet1'!$A$1:$A$5,match(A5,'sheet1'!$A$1:$A$500,0),1))+1,26),"Completed")

此公式应该找到每个 Id 的相关行,然后检查是否有任何值该行中的“已完成”。当与 if 函数结合使用时,这应该在 sheet2 中给出以下输出:

ID Complete
1  Y
2  Y
3  N

但目前,它没有像 countif 公式返回那样完整地注册任何内容每行 0。

这是因为 countif 无法使用 address 处理动态范围吗?如果有更好的方法来做到这一点,请告诉我。

In sheet1 have a column with a list of IDs, each with a set of statuses:

ID  Apr   May      Jun
1   Load  Load     Complete
2   Load  Complete NA
3   Load  Load     Load

In a separate sheet, sheet2 I have a list of the IDs and I am trying to show which of those are complete. My thinking is to use countif with a dynamic cell range using the address function:

=countif("'sheet1'!"&address(row(index('sheet1'!$A$1:$A$5,match(A2,'sheet1'!$A$1:$A$5,0),1)),3)&":"&ADDRESS(row(index('sheet1'!$A$1:$A$5,match(A5,'sheet1'!$A$1:$A$500,0),1))+1,26),"Completed")

This formula should find the relevant row for each Id and then check to see whether there are any values of 'Completed' in that row. When combined with an if function, this should give an output of the following in sheet2:

ID Complete
1  Y
2  Y
3  N

But at the moment, it is not registering any as complete as the countif formula is returning a 0 for every row.

Is this because countif cannot handle dynamic ranges using address? If there is a better way to do this, please let me know.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

可遇━不可求 2025-01-28 01:56:04

尝试:

=INDEX(IFNA(VLOOKUP(F2:F, QUERY({A2:A, FLATTEN(QUERY(TRANSPOSE(B2:D),,9^9))}, 
 "select Col1,'Complete' where Col2 contains 'Complete'"), 2, )))

或:

=INDEX(IF(F2:F="",,IFNA(VLOOKUP(F2:F, QUERY({A2:A, FLATTEN(QUERY(TRANSPOSE(B2:D),,9^9))}, 
 "select Col1,'Y' where Col2 contains 'Complete'"), 2, ), "N")))

try:

=INDEX(IFNA(VLOOKUP(F2:F, QUERY({A2:A, FLATTEN(QUERY(TRANSPOSE(B2:D),,9^9))}, 
 "select Col1,'Complete' where Col2 contains 'Complete'"), 2, )))

enter image description here

or:

=INDEX(IF(F2:F="",,IFNA(VLOOKUP(F2:F, QUERY({A2:A, FLATTEN(QUERY(TRANSPOSE(B2:D),,9^9))}, 
 "select Col1,'Y' where Col2 contains 'Complete'"), 2, ), "N")))

enter image description here

一念一轮回 2025-01-28 01:56:04

根据您的数据,请尝试以下操作

=INDEX({A2:A,IF(A2:A="","",
        (IF(REGEXMATCH(B2:B&C2:C&D2:D,"Complete")=TRUE,"Y","N")))})

在此处输入图像描述

(一如既往,请根据您的需要调整范围)

使用的函数:

Given your data, please try the following

=INDEX({A2:A,IF(A2:A="","",
        (IF(REGEXMATCH(B2:B&C2:C&D2:D,"Complete")=TRUE,"Y","N")))})

enter image description here

(As always, please adjust ranges to your needs)

Functions used:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文