w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
SUM cell values based on multiple condition - either A column or B column cell is true. Any of the two. But not always both conditions are true

Let's say you had those values in cells A1:C7, this should do the trick:

=SUMPRODUCT(C1:C7*(A1:A7="D"))+SUMPRODUCT(C1:C7*(B1:B7="D"))-SUMPRODUCT(C1:C7*(A1:A7="D")*(B1:B7="D"))

To explain the formula, it is: (Sum of C where A = "D") + (Sum of C where B = "D") - (Sum of C where both A = "D" and B = "D")

The reason for the last part is to avoid double counting.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.