SOLVED

Countifs containing an OR option

Copper Contributor

I have a spreadsheet that identifies all cattle into different classes  eg; Cow Bull etc.

I want to use Countifs to select the number of animals by class @ a given date.  I need to use Countifs with an OR in relation Date of Sale  OR( DOS being blank or DOS being after the given date ):-

=COUNTIFS(tbl_CReg[Class],"Cow",tbl_CReg[DOS],OR(tbl_CReg[DOS]">="&$H$3,ISBLANK(tbl_CReg[DOS])))

I Cant get the logic for the OR function to work..$H$3 is a date.

 

2 Replies
best response confirmed by Hans Vogelaar (MVP)
Solution

@jonh54 COUNTIFS is designed to return the count when ALL criteria are met. The OR logic will thus not work here. You'll need to sum individual COUNTIFS statements. Such a formula would then look like this:

 

=COUNTIFS(tbl_CReg[Class],"Cow",tbl_CReg[DOS],"")+COUNTIFS(tbl_CReg[Class],"Cow",tbl_CReg[DOS],">"&$H$3)

 

 

Much appreciated will make the changes.
jh
1 best response

Accepted Solutions
best response confirmed by Hans Vogelaar (MVP)
Solution

@jonh54 COUNTIFS is designed to return the count when ALL criteria are met. The OR logic will thus not work here. You'll need to sum individual COUNTIFS statements. Such a formula would then look like this:

 

=COUNTIFS(tbl_CReg[Class],"Cow",tbl_CReg[DOS],"")+COUNTIFS(tbl_CReg[Class],"Cow",tbl_CReg[DOS],">"&$H$3)

 

 

View solution in original post