Occurances within Date & Time Range - COUNTIFS

Pascal

Board Regular
Joined
Jun 6, 2007
Messages
200
Hi & Good Morning,

I have a column (H) containing Date & Time as per the following: -

14/08/2013 06:51
14/08/2013 07:08
14/08/2013 07:11
14/08/2013 07:24
14/08/2013 08:32
15/08/2013 07:51
15/08/2013 08:51
15/08/2013 09:30

I've already got a Formula as follows to Count between Hours: -

=COUNTIFS(H:H,">="&TIME(6,0,0),H:H,"<="&TIME(7,0,0))
=COUNTIFS(H:H,">="&TIME(7,0,0),H:H,"<="&TIME(8,0,0))

My question is how can I adjust the Formula so I take into account the Date?

So I could end up with some thing similar to: -

Time Period | 14th Aug | 15th Aug
06:00 - 07:00 | 1 | 0
07:00 - 08:00 | 3 | 1

Also if the Date could display the Day of Week would be a nice touch.

Many Thanks & Regards
 

MikeWx

Active Member
Joined
Jan 16, 2010
Messages
436
If your dates across the top are date values, a custom format of ddd d mmm would result in Wed 14 Aug for your first date. See my example below for a formula that will count based on both the date and the time range. Copy it down and across for the other counts. You can substitute $H:$H for a specified range of values in column H, but it will cause a significant delay as the values are calculated. I suggest a range like a few hundred or few thousand rows for column H.Sheet1

*HIJKLM
1**Time PeriodWed 14 AugThu 15 AugFri 16 Aug
28/14/2013 6:51*06:00 - 07:00100
38/14/2013 7:08*07:00 - 08:00310
48/14/2013 7:11*08:00 - 09:00110
58/14/2013 7:24*09:00 - 10:00010
68/14/2013 8:32*10:00 - 11:00000
78/15/2013 7:51*****
88/15/2013 8:51*****
98/15/2013 9:30*****

<colgroup><col style="width: 30px;"><col style="width: 115px;"><col style="width: 64px;"><col style="width: 82px;"><col style="width: 82px;"><col style="width: 76px;"><col style="width: 69px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
K2=SUMPRODUCT(--(INT($H$2:$H$20)=K$1),--(HOUR($H$2:$H$20)=HOUR(TIMEVALUE(LEFT($J2,5)))))

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie Html" target="_blank"> Excel Jeanie HTML 4
 

Pascal

Board Regular
Joined
Jun 6, 2007
Messages
200
Last edited:

Forum statistics

Threads
1,081,545
Messages
5,359,450
Members
400,528
Latest member
Ratish52

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top