-3

I'm looking for the formula to count how many times appears a color, for example, "red", from B2:D7 if A2:A7 is "B".

here is the example.

player0
  • 124,011
  • 12
  • 67
  • 124
Tes
  • 61
  • 5

1 Answers1

1
=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

player0
  • 124,011
  • 12
  • 67
  • 124
  • I don't think this provides a full answer to OP's question. Further, code-only answers are not as useful - can you offer some explanation of what you've done and why it works? – random_user_name Jul 31 '19 at 14:40
  • It works, but this was an example with only 3 columns, I need to make it in a undefined number of columns sheet, is it possible without having to write E, F, G...BE? – Tes Jul 31 '19 at 14:51
  • Second formula only counts the first time it appears. If we want to count how many times appears "RED" in "A" group it shows 3 instead of 5 – Tes Jul 31 '19 at 16:27