+ Reply to Thread
Results 1 to 15 of 15

Count the number of employees per hour

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-28-2019
    Location
    Costa Rica
    MS-Off Ver
    2016
    Posts
    117

    Count the number of employees per hour

    Hello and thank you in advance for your help.

    I am looking for a formula to count the number of employees staffed by hour.

    in other words, I need to know how many employees I have at 6am, 7am, 8am and so on.

    Can anyone share your knowledge?
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor than_gold's Avatar
    Join Date
    10-17-2017
    Location
    Coimbatore India
    MS-Off Ver
    Office 365
    Posts
    646

    Re: Count the number of employees per hour

    Try this:
    Formula: copy to clipboard
    =SUM(COUNTIFS($C$2:$C$49, {"3:00 PM","4:00 PM","5:00 PM"}))


    Check here for more info (Formula 2. SUM COUNTIFS with an array constant): https://www.ablebits.com/office-addi...omment-page-4/
    Regards,
    Thangavel D

    Appreciate the help? CLICK *

  3. #3
    Forum Contributor
    Join Date
    03-28-2019
    Location
    Costa Rica
    MS-Off Ver
    2016
    Posts
    117

    Re: Count the number of employees per hour

    thank you for all the information

  4. #4
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Count the number of employees per hour

    I'm not sure how you wanted the results presented, so I created a second worksheet "Coverage" - here is portion of the worksheet to show how it looks:

    coverage.png

    There is a column for each of the seven days of the example you provided and 24 rows - one for each hour. The body of the table is then populated with the number of people covering any particular hour via the following formula in B2 copied across and down:
    Formula: copy to clipboard
    =SUMPRODUCT(((OFFSET(Times!$B$3, 0, MATCH(B$1, Times!$B$1:$O$1, 0)-1, COUNTA(Times!$A:$A)-1, 1)<=$A2)*
    (OFFSET(Times!$B$3, 0, MATCH(B$1, Times!$B$1:$O$1, 0), COUNTA(Times!$A:$A)-1, 1)>$A2)*
    (OFFSET(Times!$B$3, 0, MATCH(B$1, Times!$B$1:$O$1, 0), COUNTA(Times!$A:$A)-1, 1)>= OFFSET(Times!$B$3, 0, MATCH(B$1, Times!$B$1:$O$1, 0)-1, COUNTA(Times!$A:$A)-1, 1))) +

    (NOT((OFFSET(Times!$B$3, 0, MATCH(B$1, Times!$B$1:$O$1, 0)-1, COUNTA(Times!$A:$A)-1, 1)>$A2)*
    (OFFSET(Times!$B$3, 0, MATCH(B$1, Times!$B$1:$O$1, 0), COUNTA(Times!$A:$A)-1, 1) <=$A2))*
    (OFFSET(Times!$B$3, 0, MATCH(B$1, Times!$B$1:$O$1, 0), COUNTA(Times!$A:$A)-1, 1) < OFFSET(Times!$B$3, 0, MATCH(B$1, Times!$B$1:$O$1, 0)-1, COUNTA(Times!$A:$A)-1, 1))) )


    The formula is repetitious rather than complex although it doubled in size due to the need to accommodate shifts that span midnight.

    See the attached workbook which implements the above.

    Let me know if this is close to what you are looking for.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    03-28-2019
    Location
    Costa Rica
    MS-Off Ver
    2016
    Posts
    117

    Re: Count the number of employees per hour

    GeoffW283, this is exactly what I was looking for. Can't thank you enough, much appreciated.

  6. #6
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Count the number of employees per hour

    Glad to help - thanks for the feedback!

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,998

    Re: Count the number of employees per hour

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  8. #8
    Forum Contributor
    Join Date
    03-28-2019
    Location
    Costa Rica
    MS-Off Ver
    2016
    Posts
    117

    Re: Count the number of employees per hour

    Hello GeoffW283, hope you are doing great.

    Some time ago, you helped me out with this request to be able to count the number of agents in schedule per hour however didn't use it that much.
    Now, I do need to use it more often but I just realized that the spreadsheet provided doesn't count that well overnight agents.


    Using the below scheduled hours for those 12 agents, I am coming up with 6 agents at 12:00:00 however we have 10 agents in schedule after 12 MN

    Oct 7th

    12:30 AM 6:30 AM
    12:30 AM 6:30 AM
    6:00 PM 12:00 AM
    6:00 PM 12:00 AM
    9:00 PM 3:00 AM
    7:00 PM 1:00 AM
    8:00 PM 2:00 AM
    OFF OFF
    7:00 PM 1:00 AM
    12:30 AM 6:30 AM
    7:00 PM 1:00 AM
    12:30 AM 6:30 AM
    9:00 PM 3:00 AM

    Can you give me a hand once more?
    I really appreciate it.

    Mente73

    I have attached the spreadsheet with sample information.
    Attached Files Attached Files

  9. #9
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,997

    Re: Count the number of employees per hour

    This array entered formula** seems to yield values that seem reasonable based on the data:
    Formula: copy to clipboard
    =IF($A2<12/24,SUM(COUNTIFS(INDEX(Times!$B$3:$N$49,,AGGREGATE(15,6,(COLUMN($B$1:$N$1)-COLUMN($A$1))/(Times!$B$1:$N$1=B$1)/(Times!$B$2:$N$2="IN"),1)),">="&$A2,INDEX(Times!$B$3:$N$49,,AGGREGATE(15,6,(COLUMN($B$1:$N$1)-COLUMN($A$1))/(Times!$B$1:$N$1=B$1)/(Times!$B$2:$N$2="IN"),1)),"<="&SUM($A2,59/1440)),COUNTIFS(Times!C$3:C$49,">="&$A2,INDEX(Times!$C$3:$O$49,,AGGREGATE(15,6,(COLUMN($C$1:$O$1)-COLUMN($B$1))/(Times!$B$1:$N$1=B$1)/(Times!$C$2:$O$2="OUT"),1)),"<="&SUM($A2,59/1440)),SUMPRODUCT((IFERROR(INDEX(Times!$B$3:$N$49,,AGGREGATE(15,6,(COLUMN($B$1:$N$1)-COLUMN($A$1))/(Times!$B$1:$N$1=B$1)/(Times!$B$2:$N$2="IN"),1))-(INDEX(Times!$B$3:$N$49,,AGGREGATE(15,6,(COLUMN($B$1:$N$1)-COLUMN($A$1))/(Times!$B$1:$N$1=B$1)/(Times!$B$2:$N$2="IN"),1))>INDEX(Times!$C$3:$O$49,,AGGREGATE(15,6,(COLUMN($C$1:$O$1)-COLUMN($B$1))/(Times!$B$1:$N$1=B$1)/(Times!$C$2:$O$2="OUT"),1)))<$A2,FALSE))*(INDEX(Times!$C$3:$O$49,,AGGREGATE(15,6,(COLUMN($C$1:$O$1)-COLUMN($B$1))/(Times!$B$1:$N$1=B$1)/(Times!$C$2:$O$2="OUT"),1))>$A2))),SUM(COUNTIFS(INDEX(Times!$B$3:$N$49,,AGGREGATE(15,6,(COLUMN($B$1:$N$1)-COLUMN($A$1))/(Times!$B$1:$N$1=B$1)/(Times!$B$2:$N$2="IN"),1)),">="&$A2,INDEX(Times!$B$3:$N$49,,AGGREGATE(15,6,(COLUMN($B$1:$N$1)-COLUMN($A$1))/(Times!$B$1:$N$1=B$1)/(Times!$B$2:$N$2="IN"),1)),"<="&SUM($A2,59/1440)),COUNTIFS(INDEX(Times!$C$3:$O$49,,AGGREGATE(15,6,(COLUMN($C$1:$O$1)-COLUMN($B$1))/(Times!$B$1:$N$1=B$1)/(Times!$C$2:$O$2="OUT"),1)),">="&$A2,INDEX(Times!$C$3:$O$49,,AGGREGATE(15,6,(COLUMN($C$1:$O$1)-COLUMN($B$1))/(Times!$B$1:$N$1=B$1)/(Times!$C$2:$O$2="OUT"),1)),"<="&SUM($A2,59/1440)),SUMPRODUCT((INDEX(Times!$B$3:$N$49,,AGGREGATE(15,6,(COLUMN($B$1:$N$1)-COLUMN($A$1))/(Times!$B$1:$N$1=B$1)/(Times!$B$2:$N$2="IN"),1))<$A2)*(IFERROR(INDEX(Times!$C$3:$O$49,,AGGREGATE(15,6,(COLUMN($C$1:$O$1)-COLUMN($B$1))/(Times!$B$1:$N$1=B$1)/(Times!$C$2:$O$2="OUT"),1))+(INDEX(Times!$B$3:$N$49,,AGGREGATE(15,6,(COLUMN($B$1:$N$1)-COLUMN($A$1))/(Times!$B$1:$N$1=B$1)/(Times!$B$2:$N$2="IN"),1))>INDEX(Times!$C$3:$O$49,,AGGREGATE(15,6,(COLUMN($C$1:$O$1)-COLUMN($B$1))/(Times!$B$1:$N$1=B$1)/(Times!$C$2:$O$2="OUT"),1)))>$A2,FALSE)))))

    Let us know if you have any questions.

    EDIT: **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    Attached Files Attached Files
    Last edited by JeteMc; 10-10-2020 at 07:06 PM. Reason: Added edit
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  10. #10
    Forum Contributor
    Join Date
    03-28-2019
    Location
    Costa Rica
    MS-Off Ver
    2016
    Posts
    117

    Re: Count the number of employees per hour

    Hello JeteMc,

    Thank you for taking the time to review and provide assistance.

    Now, it does look more accurate however you think that we should consider the agents OUT at 12 being part of that interval?

    I mean if I leave at 12am at 12:01 I no longer belong to that interval

    What are your thoughts?

    Thanks you again

    Mente73

  11. #11
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,997

    Re: Count the number of employees per hour

    To meet that condition try modifying the array entered formula (see edit in post #9) to read as follows:
    Formula: copy to clipboard
    =IF($A2<12/24,SUM(COUNTIFS(INDEX(Times!$B$3:$N$49,,AGGREGATE(15,6,(COLUMN($B$1:$N$1)-COLUMN($A$1))/(Times!$B$1:$N$1=B$1)/(Times!$B$2:$N$2="IN"),1)),">="&$A2,INDEX(Times!$B$3:$N$49,,AGGREGATE(15,6,(COLUMN($B$1:$N$1)-COLUMN($A$1))/(Times!$B$1:$N$1=B$1)/(Times!$B$2:$N$2="IN"),1)),"<="&SUM($A2,59/1440)),COUNTIFS(Times!C$3:C$49,">"&$A2,INDEX(Times!$C$3:$O$49,,AGGREGATE(15,6,(COLUMN($C$1:$O$1)-COLUMN($B$1))/(Times!$B$1:$N$1=B$1)/(Times!$C$2:$O$2="OUT"),1)),"<="&SUM($A2,59/1440)),SUM((IFERROR(INDEX(Times!$B$3:$N$49,,AGGREGATE(15,6,(COLUMN($B$1:$N$1)-COLUMN($A$1))/(Times!$B$1:$N$1=B$1)/(Times!$B$2:$N$2="IN"),1))-(INDEX(Times!$B$3:$N$49,,AGGREGATE(15,6,(COLUMN($B$1:$N$1)-COLUMN($A$1))/(Times!$B$1:$N$1=B$1)/(Times!$B$2:$N$2="IN"),1))>INDEX(Times!$C$3:$O$49,,AGGREGATE(15,6,(COLUMN($C$1:$O$1)-COLUMN($B$1))/(Times!$B$1:$N$1=B$1)/(Times!$C$2:$O$2="OUT"),1)))<$A2,FALSE))*(INDEX(Times!$C$3:$O$49,,AGGREGATE(15,6,(COLUMN($C$1:$O$1)-COLUMN($B$1))/(Times!$B$1:$N$1=B$1)/(Times!$C$2:$O$2="OUT"),1))>$A2))),SUM(COUNTIFS(INDEX(Times!$B$3:$N$49,,AGGREGATE(15,6,(COLUMN($B$1:$N$1)-COLUMN($A$1))/(Times!$B$1:$N$1=B$1)/(Times!$B$2:$N$2="IN"),1)),">="&$A2,INDEX(Times!$B$3:$N$49,,AGGREGATE(15,6,(COLUMN($B$1:$N$1)-COLUMN($A$1))/(Times!$B$1:$N$1=B$1)/(Times!$B$2:$N$2="IN"),1)),"<="&SUM($A2,59/1440)),COUNTIFS(INDEX(Times!$C$3:$O$49,,AGGREGATE(15,6,(COLUMN($C$1:$O$1)-COLUMN($B$1))/(Times!$B$1:$N$1=B$1)/(Times!$C$2:$O$2="OUT"),1)),">"&$A2,INDEX(Times!$C$3:$O$49,,AGGREGATE(15,6,(COLUMN($C$1:$O$1)-COLUMN($B$1))/(Times!$B$1:$N$1=B$1)/(Times!$C$2:$O$2="OUT"),1)),"<="&SUM($A2,59/1440)),SUM((INDEX(Times!$B$3:$N$49,,AGGREGATE(15,6,(COLUMN($B$1:$N$1)-COLUMN($A$1))/(Times!$B$1:$N$1=B$1)/(Times!$B$2:$N$2="IN"),1))<$A2)*(IFERROR(INDEX(Times!$C$3:$O$49,,AGGREGATE(15,6,(COLUMN($C$1:$O$1)-COLUMN($B$1))/(Times!$B$1:$N$1=B$1)/(Times!$C$2:$O$2="OUT"),1))+(INDEX(Times!$B$3:$N$49,,AGGREGATE(15,6,(COLUMN($B$1:$N$1)-COLUMN($A$1))/(Times!$B$1:$N$1=B$1)/(Times!$B$2:$N$2="IN"),1))>INDEX(Times!$C$3:$O$49,,AGGREGATE(15,6,(COLUMN($C$1:$O$1)-COLUMN($B$1))/(Times!$B$1:$N$1=B$1)/(Times!$C$2:$O$2="OUT"),1)))>$A2,FALSE)))))

    Let us know if you have any questions.

  12. #12
    Forum Contributor
    Join Date
    03-28-2019
    Location
    Costa Rica
    MS-Off Ver
    2016
    Posts
    117

    Re: Count the number of employees per hour

    Thanks JetMec,

    I assume the new array is for the coverage spreadsheet, what about for the hr intervals included in the time spreadsheet? Columns T to AA?

  13. #13
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,997

    Re: Count the number of employees per hour

    I forgot to delete T2:AA26 on the Times sheet before attaching the file to post #9.
    The formula in those cells represents an earlier draft of the formula shown in the post.

  14. #14
    Forum Contributor
    Join Date
    03-28-2019
    Location
    Costa Rica
    MS-Off Ver
    2016
    Posts
    117

    Re: Count the number of employees per hour

    Alright,

    Thank you enough, the new Array seems to be working as expected.

    Much appreciate it.

    Mente73

  15. #15
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,997

    Re: Count the number of employees per hour

    You're Welcome. Thank You for the feedback and for marking the thread as 'Solved'. I hope that you have a blessed day.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Formula to count employees on schedule over 24 hour period
    By brijsek in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-16-2023, 04:38 AM
  2. Number of employees on schedule per hour
    By bensorensen1019 in forum Excel General
    Replies: 1
    Last Post: 04-12-2017, 01:15 PM
  3. Replies: 1
    Last Post: 09-26-2015, 04:27 PM
  4. Count Employees Working in Half Hour Intervals
    By shanewfm in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-24-2015, 01:12 PM
  5. [SOLVED] Count the number of employees working per hour
    By esmith#001 in forum Excel Formulas & Functions
    Replies: 27
    Last Post: 12-04-2014, 07:46 AM
  6. Using Punchclock data to count employees working during each hour
    By ellenowski in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-13-2014, 10:22 AM
  7. Average number of employees per hour
    By phiphika1453 in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 04-22-2013, 03:25 AM

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