Sort and count time stamps into a 24 hour period, broken into 30 minute segments.
Hi all. I have an Excel question. I would like a method to sort and count a given amount of time stamps into a 24 hour period, broken into 30 minute segments. The file "Input" has an example input and "Output" is what I would like the end result to be. Like this:
The sample only shows time stamps from one day. Will you have multiple dates and need to specify the date element as well?
You can also use the COUNTIFS function:
=COUNTIFS(A:A,">="&$H$1+E2,A:A,"<="&$H$1+F2)
H1 = Date
E2 = lower boundary (for further rows this is previous upper boundary plus 1 second)
F2 = Upper boundary (lower boundary plus 30 minutes)
Your time values are to accuracy in seconds. I have done >= & <= for both criteria because I have set the lower and upper boundaries differently, the lower boundary of one pair is one second later that the upper boundary of the previous pair so there won't be duplicates as suggested earlier.
Wow! Thanks all. I will run a few checks and let everyone know.
Rob Henson - I am doing a 7 day period, but I get the data one day at a time. Not sure if performing the calculation 7 days at a shot would be helpful or not. I'll look into it.
fever_rca
ASKER
Thanks all! Abbas' solution does exactly what I wanted.
abbas abdulla
Hi,
You are welcomed, glad to help. The formula will fail only to count one record of the day if time is 0:0:0 - check the attached file the count returns 1800 count for all day interval which is representing the number of seconds in each 30 minutes but it return 1799 for the first interval because it fail to count the 0:00 time with the result. Input.xlsx
The formula is similar to what Abbas has suggested.
But you can also construct the time brackets as shown in the attached.
Open in new window