Countif 公式错误检查 google 工作表中具有公式的单元格中的重复项

Countif formula error checking duplicates in cells with formula in google sheets

这是我的 google 脚本: https://docs.google.com/spreadsheets/d/1A0zEN4zczP7aYn2aHdFjDxYgDJBi7R3S6NY_MTcM7YA/edit?usp=sharing

工作原理: 在我的 sheet 中有生产计划。 E 列仅用于帮助从 C 列中使用的索引计算日期(3M 000 00 0000 等于 3M [job_no] [月] [年])。在单元格 E2 的顶部,用于生成下一个作业索引的 MAX 函数是在按下 (+) 按钮后由脚本生成的。

我想得到的: 如果 C 列中的索引 (3m xxx xx xxxx) 重复,E 列中的单元格将计算 C 列中的数据或显示值“123456789”。我想在单元格 C2 中获取“索引 3M xxx xx xxxx 重复。请删除重复项”的信息。

问题是什么: 我使用 countif 函数来检查重复项: =countif(E5:E;"=123456789") 当我在 bar 中编写此函数时,它显示了良好的值 (2),但如果我单击 enter,它会在单元格 (i8) 中继续显示 0。 同样的问题是 vlookup 函数从 C 列搜索重复值的索引和名称。 我想问题是 E5:E 单元格中有 if 公式。

请帮我处理一下

要检测 C 列中的重复项,请使用此公式

=if(arrayformula(sum(--(if(C8:C="";;countif(left(C8:C;14);left(C8:C;14)))>1)))>0;"Index 3M xxx xx xxxx is duplicated. Please remove duplicates";)

以及详细信息...

=if(arrayformula(sum(--(if(C8:C="";;countif(left(C8:C;14);left(C8:C;14)))>1)))>0;"Index """
&textjoin(", ";;unique(query({C8:C\arrayformula(countif(left(C8:C;14);left(C8:C;14)))};"select Col1 where Col1 is not null and Col2>1";0)))&
""" is/are duplicated. Please remove duplicates";)

只有代码(14 个字符)

=if(arrayformula(sum(--(if(C8:C="";;countif(left(C8:C;14);left(C8:C;14)))>1)))>0;"Index """
&textjoin(", ";;unique(query({arrayformula(left(C8:C;14))\arrayformula(countif(left(C8:C;14);left(C8:C;14)))};"select Col1 where Col1 is not null and Col2>1";0)))&
""" is/are duplicated. Please remove duplicates";)