简体   繁体   English

GoogleForms动态范围(用于查找实例编号)arrayFormula中的Countif

[英]Google Sheets Dynamic Range (for finding instance number) Countif in arrayFormula

I find the instance number of a data entry by using: 我通过使用以下命令找到数据条目的实例号:

=countif(C$2:C2,C2)

When filled down, this formula displays the number of times C2,C3,C4,etc. 填写后,此公式显示C2,C3,C4等的次数。 occurs above it, thus giving its "instance number". 出现在其上方,因此给出其“实例号”。

I would like to convert this to an array formula (to avoid the need to fill down) but, 我想将其转换为数组公式(以避免填写),但是,

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

does not work. 不起作用。 I am unsure how to convert the range argument of countif to comply with the arrayformula while keeping this range dynamic. 我不确定如何在保持此范围动态的同时转换countif的range参数以符合arrayformula。

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

此处改编了一个解决方案,该解决方案最终有一个未知的来源。

=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),))

A simple way to countif with arrayformula : 一个简单的方法countifarrayformula

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

在此处输入图片说明

Tip: use the same range twice 提示:两次使用相同范围

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM