Search code examples
google-sheetsarray-formulas

Array Formula for column totals


I know how to use an array formula to auto apply a formula down a column, but I was wondering if you could do the same but along a row?

I have tried to apply the sample princple i.e rather than a range for the column, I use the rang for the row, but the sum totals are incorrect. Here is an example of what I am trying to achieve.

There is a colum per month which will auto exapand every month, with the latest month in colum B. These total are used in other sheets, so I want to avpid having to have to rember to update the new row tih sum total: Can the same principle of array formula which auto populates cells in a column, be applied to rows? enter image description here


Solution

  • You may try this in Cell_A5 of the sample datset:

    ={"total_",bycol(indirect("B2:4"),lambda(Σ,if(counta(Σ)=0,,sum(Σ))))}
    
    • added indirect() with an assumption that a new column maybe inserted at column_B to insert new/latest month data

    enter image description here