Google-sheets – Sum over a formula in Google Sheets

formulasgoogle sheetsgoogle-sheets-query

I have a Google Sheet and I need to add a lot of stuff like

(ABS(A1)+A1)/A1+ (ABS(A2)+A2)/A2+...+ (ABS(A10)+A10)/A10

but I don't want to write out the sum each time for each term A1,A2,A3,…, A10

Is there a way to write the sum more concise? like

SUM( (|x| + x)/x : for x from A1 to A10) 

I know that's not correct but that is what I want.

Best Answer

You can use an Arrayformula to achieve your goal.

You don't need to drag down a formula nor specify cells. This will work for every correct calculation in column A:

=Sum(Arrayformula(Iferror((Abs(A2:A8)+A2:A8)/A2:A8,"")))

enter image description here

or ignore iferror if you are sure A2:A8 contains numbers (and not text or blank elements):

=Sum(Arrayformula((Abs(A2:A8)+A2:A8)/A2:A8))