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!
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hello Mike, try using SUMPRODUCT like this

=SUMPRODUCT(W24:W9999,(Z24:Z9999>0)*((M24:M9999>0)+(N24:N9999>0)>0))
 
Upvote 0
=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:
Upvote 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(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:
Upvote 0
=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)
 
Upvote 0
OK, got it now...It was hard to wrap my head around the original formula...LOL...

Barry's should do what you want.
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,447
Members
448,898
Latest member
drewmorgan128

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
Back
Top