Using countifs with nested OR statement

doug firr

Board Regular
Joined
Mar 28, 2011
Messages
140
Why doesn't this work!

COUNTIFS(DB!$C:$C,"<>"&"",DB!$Q:$Q,OR(DB!$Q:$Q="-",DB!$Q:$Q>Summary!B7),DB!$N:$N,"<="&B7)

I want to say select data where:DB!C:C is not blank;
DB!Q:Q equals "-" OR is greater than B7;
DB!N:N is less than or equal to B7.

What is the proper way to nest this OR statement within the countifs statement?
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
It has to do with the way COUNTIFS handles the return value from the OR... OR will return a boolean (True of False) for the criteria given, while COUNTIFS is looking for a criteria which it will use to determine its own boolean.

If you're looking to modify it so it does work, you could try:
COUNTIFS(DB!$C:$C,"<>"&"",DB!$Q:$Q,"=-",DB!$N:$N,"<="&B7)+COUNTIFS(DB!$C:$C,"<>"&"",DB!$Q:$Q,">"&Summary!B7,DB!$N:$N,"<="&B7)

HTH,
~ Jim
 
Upvote 0
Why doesn't this work!

COUNTIFS(DB!$C:$C,"<>"&"",DB!$Q:$Q,OR(DB!$Q:$Q="-",DB!$Q:$Q>Summary!B7),DB!$N:$N,"<="&B7)

I want to say select data where:DB!C:C is not blank;
DB!Q:Q equals "-" OR is greater than B7;
DB!N:N is less than or equal to B7.

What is the proper way to nest this OR statement within the countifs statement?

oes this...
Rich (BB code):
=SUMPRODUCT(
    COUNTIFS(
      DB!$C:$C,"<>",
      DB!$Q:$Q,CHOOSE({1,2},"-",">"&B7),
      DB!$N:$N,"<="&B7))
work for you?
 
Upvote 0
Yes, awesome formula. I already submitted the piece of work based on Jim's response though but definateley keeping this one in the back pocket
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,732
Members
448,987
Latest member
marion_davis

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