Google 表格:根据 A 列中的唯一值计算 B 列中的唯一值

时间:2021-06-25 16:46:02

标签: google-sheets google-sheets-formula

我有一张大表,A 列中有重复的日期,B 列中有一些重复的名称。如果我们为一个日期计算一个 A,我需要计算每个月有多少个 A。因此,如果 01.06.2021 有两个 A,则将其计为 1。A、B、C 的列表包含大约 20 个名称。

enter image description here

1 个答案:

答案 0 :(得分:1)

试试:

=INDEX(REGEXREPLACE(""&QUERY(UNIQUE({A:B\ TEXT(A:A; "mm\×mmmm yyyy")}); 
 "select Col2, count(Col2) where Col2 is not null group by Col2 pivot Col3"); 
 "(^\d+×)"; ))

enter image description here


或者如果您需要数字:

=INDEX(IFERROR(REGEXREPLACE(QUERY(UNIQUE({A:B\ TEXT(A:A; "mm\×mmmm")}); 
 "select Col2, count(Col2) where Col2 is not null group by Col2 pivot Col3"); 
 "(^\d+×)"; ); QUERY(UNIQUE({A:B\ TEXT(A:A; "mm\×mmmm")}); 
 "select Col2, count(Col2) where Col2 is not null group by Col2 pivot Col3")))

enter image description here

相关问题