countif function

J

jerry

I have a 4 column spreadsheet. Col a = date, Col b = time in, Col c = time
out, Col d = minutes spent. I would like to count all the entries that fall
between the hrs of 8:00 AM and 8:59 AM IF there are entries in both column b
and c. If there are not entries in both col B and col C, I want to disregard
those items. Help would be appreciated.
 
T

Teethless mama

=IF(COUNT(B2:C2)=2,SUMPRODUCT(--(B2:B100<=--"8:00"),--(C2:C100>=--"8:59")),"")
 
J

jerry

jerry said:
I have a 4 column spreadsheet. Col a = date, Col b = time in, Col c = time
out, Col d = minutes spent. I would like to count all the entries that fall
between the hrs of 8:00 AM and 8:59 AM IF there are entries in both column b
and c. If there are not entries in both col B and col C, I want to disregard
those items. Help would be appreciated.

What column would I paste the ifcount statement in. I forgot to tell folks
I was using Excel 2003.
 
T

T. Valko

Try this:

Assuming the cells contain time values only or are empty (no text).

=SUMPRODUCT(--(B2:B20>=TIME(8,0,0)),--(C2:C20<>""),--(C2:C20<=TIME(8,59,0)))

Better to use cells to hold the time boundaries:

A1 = 8:00 AM
A2 = 8:59 AM

=SUMPRODUCT(--(B2:B20>=A1),--(C2:C20<>""),--(C2:C20<=A2))
 
D

Dave Peterson

I bet that this...

--(C2:C20<=TIME(8,59,0))
should really be:
--(C2:C20<TIME(9,0,0))

But that's a guess!
 
T

T. Valko

That's one of them there "6 of one, half dozen of the other" quandaries!

Although, you do save a couple of keystrokes.
 
T

T. Valko

Well, reading the OP they didn't break out the time past 59 mins.

I guess to be on the safe side you could use <TIME(9,0,0). But, I like to
try to keep things as "intuitive" as possible. If the actual boundary is
8:59 then that's what I like to use (although there are exceptions).
 

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