COUNTIFS Query

Adam12345

New Member
Joined
May 19, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
In column Wed 17, there are cell values showing military times from and to. I want to summarise the hours at the bottom of the column by the hour, for instance, how many times does the time period cover the hour of 0800 or between 0800-0859. The result needs to return 1 from the example below, for 0700 it needs to return 3, and so on.

Can anyone suggest a simple formula to extract this data from the range of cells?

Tried this formula =COUNTIF(I$10:I$301,">=1200*")-COUNTIF(I$10:I$301,">1300*"), but it only returns values starting with the first argument.

Many thanks

Adam


1684543875742.png
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
See if this is what you had in mind.

20230520 Count Overlapping Times Adam12345.xlsx
HI
1Wed 17
21900-2400
32100-2400
40600-1500
50700-1100
61200-2030
71230-1800
81400-2230
90600-1500
10
11
12
13
14
15
16Start of the Hour
170:000
181:000
193:000
204:000
215:000
226:002
237:003
248:003
259:003
2610:003
2711:002
2812:003
2913:004
3014:005
3115:003
3216:003
3317:003
3418:002
3519:002
3620:001
3721:001
3822:000
3923:000
Sheet1
Cell Formulas
RangeFormula
I17:I39I17=LET(startTime,TIME(LEFT($I$2:$I$9,2),MID($I$2:$I$9,3,2),0), endTime,TIME(MID($I$2:$I$9,6,2),RIGHT($I$2:$I$9,2),0), SUM((startTime<=H17)*(endTime>((H17+1/24)-0.00001))))
 
Upvote 0
Welcome to the MrExcel board!


The result needs to return 1 from the example below,
Am I mis-understanding the data? To me, 0600-1500, 0700-1100 and 0600-1430 all cover the 0800 hour so the count would be 3 (as per Alex's count)?

Possibly this?

23 05 20.xlsm
IJKL
9HourCount
101900-240000000
112100-240001000
120600-150002000
130700-110003000
141200-203004000
151230-180005000
161400-223006002
170600-143007003
1808003
1909003
2010003
2111002
2212003
2313004
2414004
Count Hours
Cell Formulas
RangeFormula
L10:L24L10=LET(s,--LEFT(0&I$10:I$300,5),COUNT(FILTER(s,(s-K10<=0)*(RIGHT(0&I$10:I$300,4)-(K10+59)>=0),"")))
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,312
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top