Countif 2 ranges error

SquirrelGuirrel

New Member
Joined
Feb 26, 2002
Messages
10
HI there,
I am trying to count the number of times 2 criteria are met. The loan month must be Jan and the year must be 2002. If both criteria are not meant I would like a zero value returned. I am using the following formula and getting a VALUE error
=COUNTIF(G2:G59,"JAN")*AND(H2:H59,"2002"),"0")

Do the Date and month need to be formatted as text?

I searched the old posts but couldn't find any countif with an else scenario. Thanks for your help:)
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
On 2002-04-24 09:49, SquirrelGuirrel wrote:
HI there,
I am trying to count the number of times 2 criteria are met. The loan month must be Jan and the year must be 2002. If both criteria are not meant I would like a zero value returned. I am using the following formula and getting a VALUE error
=COUNTIF(G2:G59,"JAN")*AND(H2:H59,"2002"),"0")

Do the Date and month need to be formatted as text?

I searched the old posts but couldn't find any countif with an else scenario. Thanks for your help:)

One way:

=SUMPRODUCT((G2:G59,"JAN")*(H2:H59=2002))
 
Upvote 0
Hi,

Use SUMPRODUCT
=SUMPRODUCT((G2:G59="JAN")*(H2:H59=2002))

How are the dates formatted? If they are actual dates try,

=SUMPRODUCT(MONTH(G2:G59)=1)*(YEAR(H2:H59)=2002))

Untested, so I may have messed up the parentheses. In any event, this is the route to take.

Bye,
Jay
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

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