+ Reply to Thread
Results 1 to 4 of 4

Equation That Makes Sure Every Employee Has 80 Hours Per Two Weeks

  1. #1
    Registered User
    Join Date
    03-15-2015
    Location
    Arizona
    MS-Off Ver
    Latest
    Posts
    11

    Equation That Makes Sure Every Employee Has 80 Hours Per Two Weeks

    I am trying to come up with an equation that checks to make sure every employee has 80 hours per two weeks. It is tricky because there are many different possible shifts with lengths of either 8, 9, or 10 hours. I don't really have any idea how to go about this, so any help would be greatly appreciated.

    I have attached an example schedule. All shifts that have no numbers after them are eight hour shifts. The ones with a -9 are nine hour shifts, and the -10 are ten hour shifts.

    Thanks for your help!

    TEST_SCHED.xlsx

  2. #2
    Registered User
    Join Date
    03-15-2015
    Location
    Arizona
    MS-Off Ver
    Latest
    Posts
    11

    Re: Equation That Makes Sure Every Employee Has 80 Hours Per Two Weeks

    Alright, so I have an idea, but I am not sure if there is a way to accomplish this. Starting with this equation:

    =IF(OR(ARRAYFORMULA(SUM(COUNTIF(B7:O7,{"I","A","X","R","K","E","AL","FFSL","ADM*"})))=10),"80 Hours","Error")

    I would like to embed an AND statement within the same IF statement, if that is at all possible. For instance, the equation above checks all the 8 hours shifts. If there are 10 of them then they are schedule to work 80 hours. I next need to check for a combination of 4 ten hour shifts and 5 eight hour shifts. I then need to continue checking other possible combinations that would get the employee to 80 hours.

    I know this equation below does not work, but this is what I am trying to do something similar to.

    =IF(OR(ARRAYFORMULA(SUM(COUNTIF(B7:O7,{"I","A","X","R","K","E","AL","FFSL","ADM*"})))=10,(ARRAYFORMULA(SUM(COUNTIF(B7:O7,{"R-10","I-10","X-10","A-10"})))=4,AND(ARRAYFORMULA(SUM(COUNTIF(B7:O7,{"I","A","X","R","K","E","AL","FFSL","ADM*"})))=5),"80 Hours","Error")

    Essentially I am trying to embed an AND statement within the original OR statement. Not sure if that is even allowed. I am saying something like this:

    IF 1 OR (2 AND 3) OR (3 AND 4), etc...

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Equation That Makes Sure Every Employee Has 80 Hours Per Two Weeks

    This design makes numeric calculations more challenging because you are embedding numbers into text. It would be far easier to have two columns for each day, one with your shift code and one with the shift length. The shift length is a formula based on your description above. Then getting the total hours for two weeks is trivial. See attached for an example of what I mean.
    Attached Files Attached Files
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Registered User
    Join Date
    03-15-2015
    Location
    Arizona
    MS-Off Ver
    Latest
    Posts
    11

    Re: Equation That Makes Sure Every Employee Has 80 Hours Per Two Weeks

    Thanks, 6StringJazzer. Unfortunately I am unable to change the layout of the schedule, however, I believe I found a way to get the equation to work. I changed the equation to this:

    =IF(OR(ARRAYFORMULA(SUM(COUNTIF(B7:O7,{"I","A","At","X","R","Rt","K","E","AL","TV*","FFSL","ADM*"})))=10, AND(ARRAYFORMULA(SUM(COUNTIF(B8:O8,{"R-10","I-10","X-10","A-10"})))=4, ARRAYFORMULA(SUM(COUNTIF(B7:O7,{"I","A","At","X","R","Rt","K","E","AL","TV*","FFSL","ADM*"})))=5)) ,"80 Hours","Error")

    and it appears to work!

+ 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] Can someone translate an equation so it makes sense to me?
    By Teblol in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-24-2014, 01:41 PM
  2. Employee hours - total for each employee
    By 1joie in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-17-2014, 06:01 PM
  3. [SOLVED] Function or macro to convert string with weeks, days, hours, minutes to Hours
    By kknb0800 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2012, 11:35 AM
  4. [SOLVED] HELP... Commission of 20% if an employee makes more than 2.7 times their wages
    By pogo.stix in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-08-2012, 09:23 AM
  5. Calculate employee hours for employee evaluation?
    By Triesha in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-09-2006, 10:55 AM

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