Forum Discussion
Ber93
Feb 15, 2022Brass Contributor
COUNTIFS between hours
Good morning I'm trying to count the entries that fall within a certain time range (22:00 to 4:00), and I'm using countifs, but I keep getting 0 instead of 1 even when the entry is within that ra...
- Feb 15, 2022
Actually you count events in periods 22:00-24:00 AND 00:00-04:00, they don't intersect, thus result is always 0.
You need to indicate somehow which time is from next date, i.e. add one date or so.
SergeiBaklan
Feb 15, 2022Diamond Contributor
Actually you count events in periods 22:00-24:00 AND 00:00-04:00, they don't intersect, thus result is always 0.
You need to indicate somehow which time is from next date, i.e. add one date or so.
Ber93
Feb 15, 2022Brass Contributor
Thank you so much. I solved it by nesting OR inside an IF and using TIME:
=IF(OR([@[Hour of Created]]>=TIME(22,0,0),[@[Hour of Created]]<TIME(4,0,0)),1,0)
=IF(OR([@[Hour of Created]]>=TIME(22,0,0),[@[Hour of Created]]<TIME(4,0,0)),1,0)