Search code examples
google-sheetsarray-formulas

Subtraction for two columns with arrayformula and isblank


I have a formula to subtract one column from another: =sum(F5-B5) but i need it in an array and only for non-empty cells. Ive tried the following which doesn't work:

=ARRAYFORMULA(if(isblank(A5:A),"",SUM(F5:F-B5:B)))

Anybody know what the correct formula is?


Solution

  • See if this helps

    =ARRAYFORMULA(if(isblank(A5:A),"", F5:F-B5:B))
    

    Sum is an aggregate function where the values of multiple rows are grouped together to form a single summary value. As such, sum can't be iterated over an array.