Search code examples
google-sheetsdocumentation

Can anyone look into this formula regarding ArrayFormula in Google Sheets?


Thank you all for looking into this.

Here's the formula I have in Google sheets:

=ArrayFormula(IF(ROW(A:A)=1, "R", IF((I:I)>0,SUM((K:K):(AI:AI)),"")))

  1. First it checks if it's the first cell in column "A" and if so, it'll set the label R.
  2. Then it checks if there is a value in the corresponding cell in column I
  3. If there is a value in the corresponding cell in column I, it will add all the numbers from cell K until AI else leave itself blank.

I'm putting it in an ArrayFormula in the hopes that when a new row is created it will compute the same calculations but instead of adding all the numbers in that specific row, it adds all the numbers in a 2D array.

What am I doing wrong here? Any help would be so much appreciated....


Solution

  • sum doesn't work within arrayformula. Instead try mmult;

    =ArrayFormula({"R";IF((I2:I)>0,mmult(value(K2:AI),transpose(column(K2:AI)^0)),)})
    

    enter image description here