+ Reply to Thread
Results 1 to 11 of 11

Counting People Working Each Hour

  1. #1
    Registered User
    Join Date
    11-18-2009
    Location
    DE, USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Counting People Working Each Hour

    I am trying to count the number of people scheduled for each hour of the day. I have the formula below that works but when the shift starts with a time that is PM and ends with a time that is AM it will not count accurately. I often have shifts that start at 8pm and end at 2am. The formula below will not calculate properly in this instance.

    Any help wtih this would be greatly appreciated.

    =SUMPRODUCT(($B$29>=$D$5:$D$18)*($B$29<$E$5:$E$18))

  2. #2
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191

    Re: Counting People Working Each Hour

    =sumproduct(($d$5:$d$18<=$b$29)*(mod($e$5:$e$18-$d$5:$d$18,1)>=mod($e$5:$e$18-$b$29,1)))

  3. #3
    Registered User
    Join Date
    11-18-2009
    Location
    DE, USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Counting People Working Each Hour

    Thanks for the fast response. When I put your formula in I dont get the result I am looking for. Maybe I am doing something incorrectly. I realize I didnt explain the sheet layout in the original post so I am attaching the file.

    I need the coverage chart to count the number of people working each hour even when the shift starts wtih a time in the PM and ends in a time with the AM.

    Thanks in advance for any help you can offer!

    Template Drop Down with Coverage Chart.xls

  4. #4
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191

    Re: Counting People Working Each Hour

    That helps a little bit. Try =SUMPRODUCT(($D$5:$D$18<=B29)*(MOD($E$5:$E$18-$D$5:$D$18,1)>MOD(($E$5:$E$18-TIME(,,1))-B29,1)))

  5. #5
    Registered User
    Join Date
    11-18-2009
    Location
    DE, USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Counting People Working Each Hour

    That works great except for the midnight hour. In the schedule if I enter a start time of 8pm and and end time of 2am I need to see the value of 1 in each cell of the coverage chart for 8p-9p, 9p-10p, 10p-11p, 11p-12a, 12a-1a, 1a-2a for that day.

    So far everything I try stops short of calculating beyond the midnight hour.

    Thanks again for any help you can offer!

  6. #6
    Registered User
    Join Date
    11-18-2009
    Location
    DE, USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Counting People Working Each Hour

    Thanks Darkyam for your help. I think the issue was with the formatting of the times in column B. I deleted 12:00 AM from cell B49 and typed it in again. When I did this the formatting automatically changed to a custom format and then your formula started working. Now it works just like I need it too.

    Thanks for your time, help and patience!!!!

  7. #7
    Registered User
    Join Date
    12-07-2012
    Location
    Dodge City, KS
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Counting People Working Each Hour

    Quote Originally Posted by snapper View Post
    That works great except for the midnight hour. In the schedule if I enter a start time of 8pm and and end time of 2am I need to see the value of 1 in each cell of the coverage chart for 8p-9p, 9p-10p, 10p-11p, 11p-12a, 12a-1a, 1a-2a for that day.

    So far everything I try stops short of calculating beyond the midnight hour.

    Thanks again for any help you can offer!
    Using this template as well. It is great except I am having this same issue. And the follow up formula posted does not seem to do anything.

  8. #8
    Registered User
    Join Date
    08-17-2013
    Location
    NZ
    MS-Off Ver
    Excel 2000
    Posts
    1

    Re: Counting People Working Each Hour

    Hello Darkyam,

    Are you still a forum member? If you are I have a similar problem to your solution for Counting People working every hour. I am trying to count how many kids of a specific age group we have on an hourly basis from their sign-in and sign-out times.

    Currently we have a column for their age (3 categories - under 2, 2-4yr olds and 5-6 yr olds) then a Sign-in time followed by a Sign-out time. We calculate, to the nearest 15 mins, how long they are in the centre, but now we need to provide information on how many kids of the three groups we have each hour during the day ie
    9-10am, 10-11am, 11-12pm and so on till 5pm.

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,484

    Re: Counting People Working Each Hour

    AgFox: welcome to the forum ... BUT, strictly speaking, I think you are breaking forum rules by asking your question in the thread of another member.

    Practically, though, this is a dormant thread and you would do better to start a new thread of your own. That will attract more interest from more people.

    Add a link back to this thread for background and reference ... and post a sample workbook so people can see what you are working with. But NOT in this thread

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  10. #10
    Registered User
    Join Date
    02-24-2014
    Location
    Noida, India
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Counting People Working Each Hour

    Hey... I am still not able to get it. The sheet works fine but it's not adding the value to the next day as the day changes after midnight. For example : if I select the shift as 09:00 PM - 06:00 AM in Monday, it should show value (1) in 21:00 - 22:00, 22:00 - 23:00, 23:00 - 00:00 and should ad value (1) in Tuesday -
    00:00 - 01:00
    01:00 - 02:00
    02:00 - 03:00
    03:00 - 04:00
    04:00 - 05:00
    05:00 - 06:00
    but it's not doing that. Any help is highly appreciated.

    Link to worksheet :
    http://snk.to/f-ct9eoae5
    Last edited by smadan002; 02-24-2014 at 06:51 PM. Reason: more information

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,484

    Re: Counting People Working Each Hour

    smadan002: welcome to the forum ... BUT, strictly speaking, like AgFox, I think you are breaking forum rules by asking your question in the thread of another member.

    Practically, though, this is a dormant thread and you would do better to start a new thread of your own. That will attract more interest from more people.

    Add a link back to this thread for background and reference ... and post a sample workbook so people can see what you are working with. But NOT in this thread.

    Regards, TMS

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1