Using OR in COUNTIFS

Nefarious

Board Regular
Joined
Mar 3, 2005
Messages
61
I've updated to 2007 and am trying to update a formula. Below is the formula I used in 2003 and the formula I'm trying to use in 2007 but it's not working. Any help would be appreciated.

2003 Formula:
=SUMPRODUCT(--(ProdLine="abc")+--(ProdLine="xyz"),--(ShipDate>DueDate))

2007 Formula:
=COUNTIFS(ProdLine,OR("abc","xyz"),ShipDate,"> DueDate")

I'm pretty sure my problem lies in my use of the OR function but I don't know how to get it to work.

All help is appreciated.

Thanks
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I haven't tried your formula, but I do see that the underlined argument in =COUNTIFS(ProdLine,OR("abc","xyz"),ShipDate,"> DueDate")
should be written like ">"&DueDate)
 
Upvote 0
I've updated to 2007 and am trying to update a formula. Below is the formula I used in 2003 and the formula I'm trying to use in 2007 but it's not working. Any help would be appreciated.

2003 Formula:
=SUMPRODUCT(--(ProdLine="abc")+--(ProdLine="xyz"),--(ShipDate>DueDate))

2007 Formula:
=COUNTIFS(ProdLine,OR("abc","xyz"),ShipDate,"> DueDate")

I'm pretty sure my problem lies in my use of the OR function but I don't know how to get it to work.

All help is appreciated.

Thanks

Your SumProduct formula is ill-formed, even if it works as intended.
It should run like:

=SUMPRODUCT((ProdLine="abc")+(ProdLine="xyz"),--(ShipDate>DueDate))

Even better:

=SUMPRODUCT(--ISNUMBER(MATCH(ProdLine,{"abc","xyz"},0)),--(ShipDate>DueDate))

On 2007 and later:

=SUM(COUNTIFS(ProdLine,{"abc","xyz"},ShipDate,">"&DueDate))
 
Upvote 0
Excel Workbook
ABCDEF
1ProductShip DateDue Date
2ABCMar 10, 2011Mar 01, 2011
3ABCMar 10, 2011Mar 01, 2011
4EGGMar 10, 2011Mar 01, 2011
5EGGMar 10, 2011Mar 01, 2011
6XYZMar 10, 2011Mar 01, 2011
7
83330
9
10E8=SUM(COUNTIFS(B2:B6,{"ABC","XYZ"},C2:C6,">"&D2))
11F8=SUM(COUNTIFS(B2:B6,{"ABC","XYZ"},C2:C6,">"&C2:D6))
12
1a
Excel 2003
Cell Formulas
RangeFormula
C8=SUMPRODUCT(--((B2:B6="ABC")+(B2:B6="XYZ")),--(C2:C6>D2:D6))
D8=SUMPRODUCT(--ISNUMBER(MATCH(B2:B6,{"abc","xyz"},0)),--(C2:C6>D2:D6))
Excel Workbook
NameRefers To
z=zList!$A$2
Workbook Defined Names


Nefarious

I quickly tried the above with Excel 2010.

I initially thought that there was a range of ship dates and a range of due dates.

I received correct answers with the SumProduct but I received correct answer with
Countifs only with a single DueDate.

Did I read your question incorrectly?
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,847
Members
452,361
Latest member
d3ad3y3

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