Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SUMIF of absolute values

I have a spreadsheet with values like that:

A          | B
10,55 €    | x
10,05 €    | 
-0,55 €    | x
7,55 €     | 
-88,50 €   | x

I want the absolute sum of all rows with x in B

I can get the sum of x rows with =SUMIF(B2:B100; "x"; A2:A100)

And the absolute sum of all A column with =SUMPRODUCT(ABS(A2:A100))

But I don't know how to mix those 2 formulas

like image 973
Tib Avatar asked Oct 24 '25 04:10

Tib


2 Answers

=SUMPRODUCT(IF(B2:B100="x",ABS(A2:A100)))
like image 199
TheMaster Avatar answered Oct 25 '25 20:10

TheMaster


you can use an ArrayFormula in Google docs :

=ArrayFormula(SUM(IF(B2:B100="x",ABS(A2:A100),0)))
like image 41
WNG Avatar answered Oct 25 '25 20:10

WNG