COUNTIFS With OR

meppwc

Well-known Member
Joined
May 16, 2003
Messages
604
Office Version
  1. 365
Platform
  1. Windows
Can someone help me with this syntax using COUNTIFS with OR

I want to count the number of cells where:
- Row D equals "Severity 1"
- Row G equals "Production" or "PVT"
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
maybe something like...

=SUM(COUNTIFS($D$2:$D$10,"Severity 1",$G$2:$G$10,{"Production","PVT"}))
 
Upvote 0
Thanks Weazel.............that works perfectly............what about if:
- Row D equals "Severity 1"
- Row G is not equal to "Production" or "PVT"
 
Upvote 0
ok, for some reason this is hurting my head

=SUM(COUNTIFS($D$2:$D$10,"Severity 1",$G$2:$G$10,"<>"&{"production","pvt"}))
 
Upvote 0
=SUM(COUNTIFS($D$2:$D$10,"Severity 1",$G$2:$G$10,"<>"&{"production","pvt"}))

That's going to double count because the SUM(COUNTIFS()) syntax basically creates 2 countifs formulas, 1 for <>production, and 1 for <>pvt. Then sums the result of the 2.

You need to just add a 3rd criteria to a plain old countifs
COUNTIFS($D$2:$D$10,"Severity 1",$G$2:$G$10,"<>Production",$G$2:$G$10,"<>PVT")
 
Upvote 0
ok, for some reason this is hurting my head

=SUM(COUNTIFS($D$2:$D$10,"Severity 1",$G$2:$G$10,"<>"&{"production","pvt"}))

I don't think that logic is correct. You can't use an "OR" condition with "not equal to", if you think about it.

Use an "AND" condition:

=COUNTIFS($D$2:$D$10,"Severity 1",$G$2:$G$10,"<>Production",$G$2:$G$10,"<>PVT")

Regards
 
Upvote 0
ahhhh, ok, I knew I was overthinking it, thanks for clearing the cobwebs
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,397
Members
448,957
Latest member
Hat4Life

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