Search code examples
arraysgoogle-sheetsgoogle-sheets-formulaaveragearray-formulas

Google Sheets Average of Each Row


This formula gives a single average result from the whole range, also is not dynamic.

=AVERAGE(FILTER($B:$E,ARRAYFORMULA(ROW($B:$E)>COUNT($B:$E))))

What I need from the formula is to:

  • Calculate 1 average result per row, from the second row downwards.
  • Count only the first 4 cells with values in the row, ignoring blank cells.

Example

Demo sheet


Solution

  • use in B4:

    =query(transpose(query(transpose(C4:H), 
     "select "&textjoin(",", 1, ArrayFormula(if(len(A4:A),
     "avg(Col"&ROW(A4:A)-ROW(A4)+1&")", )))&"")), 
     "select Col2")