Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google sheets 在Google工作表或Excel中按ID分组并按子唯一ID计数_Google Sheets_Google Sheets Formula_Array Formulas_Counting_Google Sheets Query - Fatal编程技术网

Google sheets 在Google工作表或Excel中按ID分组并按子唯一ID计数

Google sheets 在Google工作表或Excel中按ID分组并按子唯一ID计数,google-sheets,google-sheets-formula,array-formulas,counting,google-sheets-query,Google Sheets,Google Sheets Formula,Array Formulas,Counting,Google Sheets Query,我在谷歌表格中有这些数据(很可能与Excel中的原理相同) 例如,ID 1有1A和1B,这是两个唯一的子ID。我如何在Google sheets中以这种方式计数?如果您想使用数组公式,可以尝试以下方法: =ArrayFormula({unique(filter(A2:A,A2:A<>"")),countif(index(unique(A2:B),0,1),unique(filter(A2:A,A2:A<>"")))}) =Arra

我在谷歌表格中有这些数据(很可能与Excel中的原理相同)


例如,ID 1有1A和1B,这是两个唯一的子ID。我如何在Google sheets中以这种方式计数?

如果您想使用数组公式,可以尝试以下方法:

=ArrayFormula({unique(filter(A2:A,A2:A<>"")),countif(index(unique(A2:B),0,1),unique(filter(A2:A,A2:A<>"")))})
=ArrayFormula({unique(filter(A2:A,A2:A“”)))、countif(index(unique(A2:B),0,1)、unique(filter(A2:A,A2:A“”)))

如果您想使用数组公式,可以尝试以下方法:

=ArrayFormula({unique(filter(A2:A,A2:A<>"")),countif(index(unique(A2:B),0,1),unique(filter(A2:A,A2:A<>"")))})
=ArrayFormula({unique(filter(A2:A,A2:A“”)))、countif(index(unique(A2:B),0,1)、unique(filter(A2:A,A2:A“”)))
使用:

=ARRAYFORMULA(IFNA(VLOOKUP(A1:A, QUERY(UNIQUE(A1:B), 
 "select Col1,count(Col2) where Col1 is not null group by Col1"), 2, 0)))
使用:

=ARRAYFORMULA(IFNA(VLOOKUP(A1:A, QUERY(UNIQUE(A1:B), 
 "select Col1,count(Col2) where Col1 is not null group by Col1"), 2, 0)))

从技术上讲,您的公式在谷歌表单中有效,但返回0。你到底想做什么?计算A列和B列的所有唯一组合?不,它不起作用。我想知道组ID 1的唯一子ID的数量,我不能做透视表,因为我有很多ID。你不能简单地使用
=COUNTA(UNIQUE(FILTER(B:B,A:A=A2))
=COUNTUNIQUE(query(A1:B,“select B where A=1”)
你的公式在谷歌表单中技术上是有效的,但它返回0。你到底想做什么?计算A列和B列的所有唯一组合?不,它不起作用。我想知道组ID 1的唯一子ID的数量,我不能做透视表,因为我有很多ID。你不能简单地使用
=COUNTA(UNIQUE(FILTER(B:B,A:A=A2))
=COUNTUNIQUE(query(A1:B,“选择B,其中A=1”)