Count #of Employees Worked Between Time Periods

MrRajKumar

Active Member
Joined
Jan 29, 2008
Messages
291
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have the following data.

A2;A100 Names
B2:B100 Start Time
C2:C100 End Time

Times are in HH:MM format. In F2:F25 I have hour interval (00-23).

In G2:G25, I would like to get a count of employees who will be working on each time intervals.

eg: if an employee starts at 07:00 AM and end at 12:00 PM, then he will be available in hour interval 7,8,9,10,11,12
Another employee starts at 08:00 and ends at 14:00, then the count for hour 8, should be 2
etc..

NameStart TimeEnd Time
A07:00 AM11:00 AM
B08:00 AM04:00 PM
C07:00 AM10:00 AM
D02:00 PM09:00 PM
E03:00 PM10:00 PM
F11:00 AM07:00 PM
 

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 Column G here works for you:
Book3
ABCDEFGHIJKLM
1NameStart TimeEnd TimeTotalABCDEF
2A07:0011:0000:000000000
3B08:0016:0001:000000000
4C07:0010:0002:000000000
5D14:0021:0003:000000000
6E15:0022:0004:000000000
7F11:0019:0005:000000000
806:000000000
907:002101000
1008:003111000
1109:003111000
1210:003111000
1311:003110001
1412:002010001
1513:002010001
1614:003010101
1715:004010111
1816:004010111
1917:003000111
2018:003000111
2119:003000111
2220:002000110
2321:002000110
2422:001000010
2523:000000000
Sheet1
Cell Formulas
RangeFormula
H1:M1H1=TRANSPOSE($A$2:$A$7)
F2:F25F2=TIME(SEQUENCE(24,1,0,1),0,0)
G2G2=SUM((($F2>=$B$2:$B$7)*($F2<=$C$2:$C$7)))
H2:M25H2=SUM((($F2>=$B$2:$B$7)*($F2<=$C$2:$C$7)*(H$1=$A$2:$A$7)))
G3:G25G3=SUM(((F3>=$B$2:$B$7)*(F3<=$C$2:$C$7)))
Dynamic array formulas.
 
Upvote 0
If you're just interested in the totals, try this spill formula:

Book1
ABCDEFG
1NameStart TimeEnd TimeTotal
2A7:0011:000:000
3B8:0016:001:000
4C7:0010:002:000
5D14:0021:003:000
6E15:0022:004:000
7F11:0019:005:000
86:000
97:002
108:003
119:003
1210:002
1311:002
1412:002
1513:002
1614:003
1715:004
1816:003
1917:003
2018:003
2119:002
2220:002
2321:001
2422:000
2523:000
Sheet6
Cell Formulas
RangeFormula
F2:F25F2=TIME(SEQUENCE(24,1,0,1),0,0)
G2:G25G2=MMULT((F2:F25>=TRANSPOSE(B2:B7))*(F2:F25<TRANSPOSE(C2:C7)),SEQUENCE(COUNTA(A2:A10),,,0))
Dynamic array formulas.


Note that the totals don't match the totals from awoohaw's formulas. For example, the 10:00 - 11:00 range. I don't think C should be counted. But take a look and let us know.
 
Last edited:
Upvote 0
Sorry friends for the late reply,

How can I tweak this formula for the time that pass midnight. Eg: Start time: 21:00 & End 05:00.
How can I count them the hours during 21 to 05?
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

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