Google表格动态范围(用于查找实例编号)在arrayFormula中的Countif

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

我通过使用以下方法找到数据条目的实例编号:

=countif(C$2:C2,C2)

当填充时,该公式显示C2,C3,C4等的次数。发生在它上面,从而给出它的“实例号”。

我想将其转换为数组公式(以避免需要填写)但是,

=arrayformula(countif(C$2:C2,C2:C))

不起作用。我不确定如何转换countif的范围参数以符合arrayformula,同时保持此范围的动态。

示例表:https://docs.google.com/spreadsheets/d/1cApbO2HdeiaJd7yEkS1oFzxEG5wuM2XHLU7CK_OqRCA/edit#gid=0

arrays google-sheets formulas array-formulas
2个回答
1
投票

改编了here的解决方案,该解决方案最终具有未知来源。

=ArrayFormula(if(len(A2:A),index(sort(iferror({sort(row(A2:A),A2:A,1),row(A2:A)-row()+2-vlookup(sort(A2:A),{unique(A2:A),iferror(match(unique(A2:A),sort(A2:A),0))},2,0)})),,2),))

1
投票

countif一起使用arrayformula的简单方法:

=ArrayFormula(COUNTIF(A1:A6,A1:A6))

enter image description here

提示:使用相同的范围两次

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