Search code examples
excelexcel-formulasumifs

SUMIFS with AND and OR


I've tried, I think most of the answers here, but I can not get them to work in my situation.

Translated to text, my problem would looked like this :

Sum Y:Y column with

  • condition 1 : Column B:B if string starts with "15*"

  • condition 2 : Column T:T must be greater then 0

  • condition 3 : OR (value from column U:U = 0 OR U:U > V:V )

Put in SUMIFS function, in theory, it would looked like this SUMIFS(Y:Y,B:B,"15*",T:T,">0",or(U:U,"=0", U:U>V:V)), but of course it doesn't work like that.

Also I've tried SUMPRODUCT and SUM(SUMIF...but I don't know how to translate what I like to accomplish into these two.

So please, if someone knows how to make this work. And some explanation please.

Thanks.


Solution

  • Here's SUMPRODUCT based solution which shall work for you.

    =SUMPRODUCT(--(LEFT(B:B,2)="15"),--(T:T>0),((U:U=0)+(U:U>V:V)),Y:Y)

    Caution: Apply complete column references only if necessary as it will slow down your sheet considerably. It is advisable to have a sufficiently large range (but not whole column references) as each column will have million cells to check.

    Also note Barry's query about column V being negative has significance on the formula I have posted as it will calculate 2 TRUE conditions as 2 and therefore lead to erroneous result.