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

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
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,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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