SUMIFS and OR

M

mohavv

Hi,

Is there a way to use the OR function within the SUMIFS function, if
you only want to sum two criteria-values (not consecutive).

Cheers,

Harold
 
H

Herbert Seidenberg

Example:
AA BB CC DD EE
45 E 101 E 3
71 B 105 D 6
64 B 102 C 3
42 E 103 C 2
50 B 104 D 7
36 D 101 E 1
84 D 102 B 3
86 B 105 D 8
18 C 102 D 7
27 D 105 C 5
46 E 105 B 9
42 C 101 D 9
Regular ANDed SUMIFS and SUMPRODUCT formulas might be
=SUMIFS(AA,BB,"B",CC,105,DD,"D",EE,">5") =157
=SUMPRODUCT(AA*(BB="B")*(CC=105)*(DD="D")*(EE>5)) =157
The same formulas with ORed criteria would be
=SUM(AA)-SUMIFS(AA,BB,"<>B",CC,"<>105",DD,"<>D",EE,"<=5") =404
=SUMPRODUCT(AA*NOT(NOT(BB="B")*NOT(CC=105)*NOT(DD="D")*NOT(EE>5)))
=404
 
M

mohavv

Example:
AA      BB      CC      DD      EE
45      E       101     E       3
71      B       105     D       6
64      B       102     C       3
42      E       103     C       2
50      B       104     D       7
36      D       101     E       1
84      D       102     B       3
86      B       105     D       8
18      C       102     D       7
27      D       105     C       5
46      E       105     B       9
42      C       101     D       9
Regular ANDed SUMIFS and SUMPRODUCT formulas might be
=SUMIFS(AA,BB,"B",CC,105,DD,"D",EE,">5")    =157
=SUMPRODUCT(AA*(BB="B")*(CC=105)*(DD="D")*(EE>5))  =157
The same formulas with ORed criteria would be
=SUM(AA)-SUMIFS(AA,BB,"<>B",CC,"<>105",DD,"<>D",EE,"<=5")   =404
=SUMPRODUCT(AA*NOT(NOT(BB="B")*NOT(CC=105)*NOT(DD="D")*NOT(EE>5)))
=404

I meant Two values in the same column/area.
example (not working) =SUMIFS(aa,bb,"B",bb,"E")
=SUMIFS(aa,bb,OR("B","E"))

Cheers,

Harold
 
H

Herbert Seidenberg

The same format applies.
Just OR the same column two (or more) times.
=SUM(AA)-SUMIFS(AA,BB,"<>B",BB,"<>E") =404
=SUMPRODUCT(AA*NOT(NOT(BB="B")*NOT(BB="E"))) =404
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Filtering with SUMIFS 1
SUMIFS error 1
SUMIFS using an "Or" condition? 13
sumifs problem 1
SUMIF (or SUMIFS): Can I have multiple EITHER OR criteria 1
Sumifs 9
SUMIFS 3
SUMIFS 8

Top