Search code examples
google-sheetsarray-formulas

Google Sheet Arrayformula with multiple mathematical functions


How would I go about formatting an arrayformula for this?:

=$D10*(sum($F10:$I10))

I've tried a few different ways but none of them work. I have a bunch of rows with that formula (where of course the row number matches, so for example:

=$D10*(sum($F10:$I10))
=$D11*(sum($F11:$I11))
=$D12*(sum($F12:$I12)) etc...

I need this formula in each row but I'm trying to figure out an arrayformula so that it works when I add or subtract rows.

Thanks for your help!

UPDATE************************************************************************

I've just figured out that =arrayformula(D7:D*(F7:F+G7:G+H7:H+I7:I)) works but I might need to add and subtract columns too. Is there a way to make it work with sum()?


Solution

  • I believe MMULT can be a good alternative:

    =ArrayFormula(if(len(D2:D), D2:D*mmult(N(F2:I),transpose(column(F2:I2)^0)),))
    

    Change ranges to suit.