计算跨列显示文本的次数

时间:2019-07-31 13:56:02

标签: google-sheets google-sheets-formula countif google-sheets-query google-query-language

我正在寻找一个公式来计算如果A2:A7为“ B”,则从B2:D7出现一种颜色(例如,“红色”)的次数。

here is the example

1 个答案:

答案 0 :(得分:0)

=COUNTA(IFERROR(QUERY(A2:D, 
 "select A 
  where A = 'B' 
    and (B = 'RED' 
     or  C = 'RED'
     or  D = 'RED')", 0)))

0


=ARRAYFORMULA(COUNTA(IFERROR(QUERY(TRANSPOSE(TRIM(QUERY(TRANSPOSE(FILTER(
 IF(B2:D="RED", 1, ), A2:A="B")),,999^99))), "where Col1 is not null", 0))))

0


=ARRAYFORMULA(COUNT(IFERROR(FILTER(
 IF(B2:D="RED", 1, ), A2:A="B"))))

9