Countif between two dates

G

Guest

I have the following formular:

=IF($B5002="","",COUNTIF(MAIN!$B$10:$B$5000,"" &$B5002 & ""))
Column A is the date
Column B is the unit

How do I modify it to count between two dates that are in cells Sheet2 P3
and R3

Thank you
 
B

Bob Phillips

=IF($B5002="","",SUMPRODUCT(--(Main!$A$10:$A$5000>=Sheet2!P3),--(Main!$A$10:$A$5000<=Sheet2!R3),--(Main!$B$10:$B$5000=$B5002)))

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
G

Guest

That works fine
Thank you
--
AOP


Bob Phillips said:
=IF($B5002="","",SUMPRODUCT(--(Main!$A$10:$A$5000>=Sheet2!P3),--(Main!$A$10:$A$5000<=Sheet2!R3),--(Main!$B$10:$B$5000=$B5002)))

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top