Search code examples
google-sheetsformulaarray-formulasgoogle-sheets-formulagoogle-sheets-query

How to use COUNTA in a Google Sheets array formula


I am trying to do an array formula that counts the errors in some columns and if it finds it scores the row as failed and vice versa I tried this formula but it didn't work

=arrayformula(IF(ROW(B:B)=1,"Transaction Score",IF(LEN(B:B)=1,IFERROR(1/0),IF(COUNTA(CV:CW,DJ:EC,ED:EJ,CI:CO,BO:CH,BA:BB,AM:AT,S:AL,D:E)>0,"Fail","Pass"))))

I need it to do it row by row but in here it counts all of them so it makes them all failed

here is a spreadsheet containing sample data https://docs.google.com/spreadsheets/d/1SksZv0h82j5oEZBj2AN5anDFr80AYNR5ettSwkpUKys/edit?usp=sharing


Solution

  • ={"Transaction Score"; ARRAYFORMULA(IF(LEN(A2:A), 
     IF(IFERROR(REGEXEXTRACT(TRANSPOSE(QUERY(TRANSPOSE(
     IF({CV:CW, DJ:EJ, BO:CO, BA:BB, S:AT, D:E}="No", "♦", )),, 999^99)), "♦"))="♦", 
     "Fail", "Pass"), ))}
    

    0