Search code examples
if-statementgoogle-sheetssumarray-formulascumulative-sum

SUMIF with ARRAYFORMULA, Argument must be range error


I'm trying to do a modified version of this formula (copied from here).

=ARRAYFORMULA(SUMIF(ROW(D1:D10), "<=" & ROW(D1:D10), D1:D10))

But when I changed it to

=ARRAYFORMULA(SUMIF(ROW(D1:D10), "<=" & ROW(D1:D10), IF(D1:D10 <= 50, D1:D10 * 2, D1:D10)))

It gave me a bunch of N/A "Argument must be a range" error.

I know I could use a helper column for the IF part, but is it possible to do this without one?

Column D Expected output
17 34
63 97
78 175
25 225

Solution

  • use:

    =INDEX(IF(D1:D="",,MMULT(TRANSPOSE((ROW(D1:D)<=TRANSPOSE(ROW(D1:D)))*
     IF(D1:D<50, D1:D*2, D1:D)), SIGN(D1:D)))
    

    enter image description here