or?

MikeC2006

New Member
Joined
Sep 10, 2008
Messages
38
instead of doing something like this:

=SUMIFS(W24:W9999,Z24:Z9999,">0",M24:M9999,">0")+SUMIFS(W24:W9999,Z24:Z9999,">0",N24:N9999,">0")-SUMIFS(W24:W9999,M24:M9999,">0",N24:N9999,">0",Z24:Z9999,">0")

is there a way to insert an "or" so the funtcion would look something like:
=sumifs(W24:W9999,Z24:Z9999,">0",M24:M9999,">0" OR N24:N9999,">0")

i know there is... i just can't find it... and searching for "or" on the message board or online help returns too many hits...

thanks for the help!
 

Some videos you may like

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
Hello Mike, try using SUMPRODUCT like this

=SUMPRODUCT(W24:W9999,(Z24:Z9999>0)*((M24:M9999>0)+(N24:N9999>0)>0))
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
=SUMIFS(W24:W9999,Z24:Z9999,">0",M24:M9999,">0")+SUMIFS(W24:W9999,Z24:Z9999,">0",N24:N9999,">0")-SUMIFS(W24:W9999,M24:M9999,">0",N24:N9999,">0",Z24:Z9999,">0")

I hope that is just an example that you just threw together, because it makes almost no sense...
It's checking the same criteria in
Cols Z M , then Z again, and N.
so it's adding Z twice, then M and N
Then it's subtracting Z M and N
Leaving one Z

so that can all be reduced to a single sumif, to check criteria in Z and sum W.
=SUMIF(Z24:Z9999,">0",W24:W9999)
 
Last edited:

MikeC2006

New Member
Joined
Sep 10, 2008
Messages
38

ADVERTISEMENT

or something like this ?

=SUMIFS(W24:W9999,Z24:Z9999,">0",((M24:M9999 OR N24:N9999),">0"))
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825

ADVERTISEMENT

See my earlier reply......
 

MikeC2006

New Member
Joined
Sep 10, 2008
Messages
38
I hope that is just an example that you just threw together, because it makes almost no sense...
It's checking the same criteria in
Cols Z M , then Z again, and N.
so it's adding Z twice, then M and N
Then it's subtracting Z M and N
Leaving one Z

so that can all be reduced to a single sumif, to check criteria in Z and sum W.
=SUMIF(W24:W9999,Z24:Z9999,">0")

Jonmo, it works for what I need it to do, it's just not very elegant ;)

I don't think you're example (sumif) will work because i need it to check M or N...

I need to sum W if z>0 and (M or N)>0

=SUMIFS(W24:W9999,Z24:Z9999,">0",((M24:M9999 OR N24:N9999),">0"))
 
Last edited:

MikeC2006

New Member
Joined
Sep 10, 2008
Messages
38
=SUMIFS(W24:W9999,Z24:Z9999,">0",M24:M9999,">0")+SUMIFS(W24:W9999,Z24:Z9999,">0",N24:N9999,">0")-SUMIFS(W24:W9999,M24:M9999,">0",N24:N9999,">0",Z24:Z9999,">0")

I hope that is just an example that you just threw together, because it makes almost no sense...
It's checking the same criteria in
Cols Z M , then Z again, and N.
so it's adding Z twice, then M and N
Then it's subtracting Z M and N
Leaving one Z

so that can all be reduced to a single sumif, to check criteria in Z and sum W.
=SUMIF(Z24:Z9999,">0",W24:W9999)

it sums W if Z>0 and M>0 then sums W if Z>0 and N>0 then subtracts W when Z>0 and M>0 and N>0 giving me the sum of W when Z>0 and M or N>0

(if i didn't add the subtraction at the end, my result was twice as large as it should have been because if there were values in M and N it added it twice)
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
OK, got it now...It was hard to wrap my head around the original formula...LOL...

Barry's should do what you want.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,414
Messages
5,596,001
Members
414,037
Latest member
Roamingsmile

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top