Search code examples
if-statementgoogle-sheetsmaxarray-formulasgoogle-sheets-query

Array Formula to Automatically Calculate


I want an array formula to use with Google Forms data to automatically calculate running metrics on my data.

In this case, in column BF I want it to auto-calculate whenever new responses come in.

I'm trying to use this formula below but isn't working for all column, just for the first line.

=ArrayFormula(If(isblank($BF$3:$BF);"";(INDEX($C$1:$BD$1;0;MATCH(MAX($C3:$BD3);$C3:$BD3;0)))))

My Google Sheet

What I'm doing wrong?

My Google Sheet:

https://docs.google.com/spreadsheets/d/1iD75djqdY8qtClEHpKUEvAS55bP0ARv9AnDUz9mFBuc/edit?usp=sharing


Solution

  • delete range BE:BF

    paste this in BE1:

    ={"MAX"; ""; ARRAYFORMULA(QUERY(TRANSPOSE(QUERY(TRANSPOSE(C3:BD); 
     "select "&TEXTJOIN(","; 1; IF(A3:A<>""; 
     "max(Col"&ROW(A3:A)-ROW(A3)+1&")"; ))&"")); 
     "select Col2"; 0))}
    

    paste this in BF1:

    ={"TIPO"; ""; ARRAYFORMULA(IF(A3:A="";;TRIM(TRANSPOSE(QUERY(TRANSPOSE(
     IF(C3:BD=QUERY(TRANSPOSE(QUERY(TRANSPOSE(C3:BD); 
     "select "&TEXTJOIN(","; 1; IF(A3:A<>""; 
     "max(Col"&ROW(A3:A)-ROW(A3)+1&")"; ))&"")); 
     "select Col2"; 0); C1:1; ));;99^99)))))}
    

    0