Formula to count max employees at any time

asad

Well-known Member
Joined
Sep 9, 2008
Messages
1,434
Hi Guys,

I have the following times of duty for our employees. What I would like to do is count the maximum number of employees that will be on site during the day. Can someone please help me? There are different employee number for different days. Data below shows 4 of the days. The actual table is much bigger with a lot more employees.

StartMeal StartMeal EndFinishTotalDay
03:3306:2707:2711:4407:11Mon,Tue,Wed
03:4507:3008:1612:3308:02Mon,Tue,Wed
03:4807:4808:3712:4708:10Mon,Tue,Wed
04:0306:5607:4111:5807:10Mon,Tue,Wed
04:1808:3009:1912:1207:05Mon,Tue,Wed
04:3308:4309:3313:4308:20Mon,Tue,Wed
05:0309:2110:0112:5907:16Mon,Tue,Wed
05:1009:2810:1513:0807:11Mon,Tue,Wed
05:2509:4710:4313:3607:15Mon,Tue,Wed
05:4010:2511:2514:1807:38Mon,Tue,Wed
05:5510:1011:0414:0207:13Mon,Tue,Wed
06:0310:5311:5316:0709:04Mon,Tue,Wed
06:3311:1412:1416:3309:00Mon,Tue,Wed
08:1811:2812:2816:4207:24Mon,Tue,Wed
08:2012:3813:3818:0108:41Mon,Tue,Wed
08:5013:1314:1318:4308:53Mon,Tue,Wed
09:0712:1713:1717:4007:33Mon,Tue,Wed
11:3414:2715:2319:4907:19Mon,Tue,Wed
11:4114:4415:4419:5707:16Mon,Tue,Wed
12:3015:1816:0520:2107:04Mon,Tue,Wed
12:4415:3716:1920:3707:11Mon,Tue,Wed
13:1916:1617:1521:2107:03Mon,Tue,Wed
13:5416:5017:3621:5107:11Mon,Tue,Wed
14:1518:3519:1722:1107:14Mon,Tue,Wed
15:0419:2320:2324:2108:17Mon,Tue,Wed
15:5320:0320:5324:5108:08Mon,Tue,Wed
16:0520:2321:2325:2108:16Mon,Tue,Wed
16:2020:4321:4325:4508:25Mon,Tue,Wed
16:2120:5321:5325:5208:31Mon,Tue,Wed
16:3521:1322:1324:5607:21Mon,Tue,Wed
19:2822:3323:3328:0007:32Mon,Tue,Wed
19:4822:5523:5528:3007:42Mon,Tue,Wed
19:5823:4624:3129:0508:22Mon,Tue,Wed
03:3307:3808:2511:2507:05Thu
03:4507:3108:3112:4908:04Thu
03:4807:5208:3712:4008:07Thu
04:0308:1309:1313:2508:22Thu
04:1807:0307:4311:5506:57Thu
04:3307:2408:0712:3007:14Thu
05:1909:3410:2514:4308:33Thu
05:3410:0711:0715:2108:47Thu
05:4108:3709:2513:4207:13Thu
05:5510:2511:2514:2407:29Thu
06:0910:3711:3716:0208:53Thu
06:2310:5511:5516:2008:57Thu
06:4411:3112:3116:5609:12Thu
07:0510:1010:5513:4905:59Thu
07:1912:0113:0117:3209:13Thu
07:4512:3113:3117:5509:10Thu
08:5013:2514:2518:5909:09Thu
09:3813:4514:4319:0808:32Thu
09:5614:0315:0119:3508:41Thu
10:0814:3115:3119:5008:42Thu
12:0214:5315:5320:2507:23Thu
13:1416:1117:0721:2107:11Thu
13:3217:5218:4624:0109:35Thu
13:5016:4717:3521:5107:13Thu
13:5616:5317:4220:4305:58Thu
14:0218:2019:1024:2109:29Thu
15:3219:4820:3325:4509:28Thu
15:52 20:1904:27Thu
16:2020:3021:2325:2108:08Thu
16:2720:5321:5325:5208:25Thu
16:3421:1322:1326:0508:31Thu
19:2822:3323:3328:0007:32Thu
19:4822:5523:5528:3007:42Thu
20:4824:4325:4329:0007:12Thu


<colgroup><col span="5"><col></colgroup><tbody>
</tbody>


Thanks and Regards
Asad
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
I do not know if a formula can get the result. But if you want with a macro I can give you the result of maximum employees per day.
Just tell me in which cell your data begins.
 
Upvote 0
Thanks a lot DanteAmor.
Macro is fine with me. The data begins in cell B3.
Thanks
Asad
 
Upvote 0
I would like to do is count the maximum number of employees that will be on site during the day

Hi Asad, reviewing your data, I really do not know what the count is.
You could explain with the example you put, what you want to count and what the result is.
You want to know the maximum number of employees are at a time of the day. Or in time ranges from 3 to 4, from 4 to 5, from 5 to 6, from 6 to 7, etc. Or in a range of schedules.
There are several possibilities and I prefer an explanation.
 
Upvote 0
you could use SUMPRODUCT . .
the # of people on site at time O1 is:
Code:
=SUMPRODUCT(--($A$2:$A$68 < O$1),--($D$2:$D$68 > O$1))
<o$1),--($d$2:$d$68>
(time O1 is between value in col A and value in col D)

the # of people havinfg a meal at time O1 is:
Code:
=SUMPRODUCT(--($B$2:$B$68 < O$1);--($C$2:$C$68 > O$1))<o$1),--($c$2:$c$68>
(time O1 is between value in col B and value in col C)

the # of people on site NOT having a meal at time O1 is:
Code:
=SUMPRODUCT(--($A$2:$A$68 < O$1),--($D$2:$D$68 > O$1)) - SUMPRODUCT(--($B$2:$B$68 < O$1),--($C$2:$C$68 > O$1))
</o$1),--($c$2:$c$68></o$1),--($d$2:$d$68>
 
Last edited:
Upvote 0
oh . . and make colums with different time-stamps (in O1, P1, Q1 etc.), copy the formula to each col . .
and you will find at 10:00 there are 32 people, the max of the day
 
Last edited:
Upvote 0
oh . . and make colums with different time-stamps (in O1, P1, Q1 etc.), copy the formula to each col . .
and you will find at 10:00 there are 32 people, the max of the day



I would like to do is count the maximum number of employees that will be on site during the day


What I did not understand about the question is if you need the number of concurrent employees. That makes more sense.
Because people who work in a day are 34, schedules that do not have concurrency are only 2: 03:33 and 24:31:00
But there are not 32 employees in the day, in any case 34 people are the people who worked on the day.
But concurring, for example at 9:19 is 16, is the maximum number of concurrency in a schedule.
 
Upvote 0
you are probably right . . I ignored the day-column
let's wait for asad's reply (probably in deep sleep by now)
 
Upvote 0
Many thanks Rupesh and DanteAmor.
I want maximum concurrent employees which should be 21 at about 11:41 in the above example. This is taking into account all the employees coming in the car park and any employee leaving the car park. So I think I should add 10 minutes to my calculations on both sides or rather subtract 10 minutes from start time and add 10 minutes to the finish time.
What do you guys suggest?
 
Upvote 0

Forum statistics

Threads
1,214,625
Messages
6,120,598
Members
448,973
Latest member
ksonnia

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