+ Reply to Thread
Results 1 to 11 of 11

Calculation of inconvenient working hours

  1. #1
    Registered User
    Join Date
    08-15-2018
    Location
    Stovkholm, Sweden
    MS-Off Ver
    2016
    Posts
    5

    Calculation of inconvenient working hours

    Would need some help setting up a formula in Excel for calculation of inconvenient working hours.
    I would be very happy if Step 1 below could be solved. We have another complication which I describe in Step 2. If that one could be solved too, that would be fantastic. Is it possible to solve both within the same formulas?

    Step1

    I work in a company where the employees will have additions to the salary for working inconvenient hours. We have 3 different categories of additions to the salary. All other hours (6 AM - 6 PM on weekdays) come at standard rates.
    Cat A: Weekday nights between 6 PM - 6 AM

    Cat B: Daytime during weekends: 6 AM - 6 PM

    Cat C: Nights during weekend 6 PM - 6 AM

    How can I control for that the formula calculates the inconvenient hours correctly?

    Example: A person is working 3 PM - 1 AM on a Monday, i.e there should be a formula calculating additional salary according to Cat A from 6 PM until 1 AM. 3 PM - 6 PM comes at standard rates.


    Step 2

    We have a rule stating that "If the employee works at night before a weekday, and the shift has begun before 12 PM there should be additional salary until the end of the shift, however at longest until 8 AM the morning after.
    So in fact, these are hours that we would need to take into account for calculation everything correctly:

    Cat A: Weekday nights between 6 PM - 6 AM (or until 8 AM if the shift started before 12 PM)

    Cat B: Daytime during weekends: 6 AM - 6 PM

    Cat C: Nights during weekend 6 PM - 6 AM (or until 8 AM Sunday night (ending Monday morning) if the shift started before 12 PM)

    Example: A person is working 10 PM - 9 AM on a Monday, i.e there should be a formula calculating additional salary according to Cat A from 10 PM until 8 AM. 8 AM-9 AM should come at standard rate.


    Thank you very much in advance for your help!

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Calculation of inconvenient working hours

    quick questions

    if someone works 1am to 5am on Monday morning, is that classed as weekend or weekday? and is that the same if the work from say 9pm on Sunday to 5am Monday? Also the same question for a Friday night/saturday morning.
    If someone has helped you then please add to their Reputation

  3. #3
    Registered User
    Join Date
    08-15-2018
    Location
    Stovkholm, Sweden
    MS-Off Ver
    2016
    Posts
    5

    Re: Calculation of inconvenient working hours

    Hi,

    Thank you for your reply. I am sorry for my late response.


    1 am to 5 am (in fact until 6 am, and until 8 am if the shift began before 12 pm) on Monday morning is classified as weekend (Cat C). Hence the whole shift from 9pm Sunday - 5 am Monday is cat C.


    1 am to 5 am (in fact until 6 am) Friday night/Saturday morning is also weekend, Cat C.


    Just let me know if you have further questions.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Calculation of inconvenient working hours

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential information is removed first!!

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  5. #5
    Registered User
    Join Date
    08-15-2018
    Location
    Stovkholm, Sweden
    MS-Off Ver
    2016
    Posts
    5

    Re: Calculation of inconvenient working hours

    Hi,

    Thank you.

    I have now attached a file with examples and expected output.

    Kind regards
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,532

    Re: Calculation of inconvenient working hours

    Hello marguv and Welcome to Excel Forum.
    This proposed solution adds a column (D) that displays the date the shift ends using: =IF(E3<C3,A3+1,A3)
    Column G, remember everything is moved a column to the right, is populated using: =((D3+E3)-(A3+C3))*24
    Column H is populated using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Column I is populated using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Column J is populated using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    The formulas produce some zero values which are hidden using custom formatting 0;;;@
    I have not tested any further than to make sure the formulas return the results shown in the Examples file.
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  7. #7
    Registered User
    Join Date
    08-15-2018
    Location
    Stovkholm, Sweden
    MS-Off Ver
    2016
    Posts
    5

    Re: Calculation of inconvenient working hours

    Dear JeteMc, Sorry for my very late reply, and thank you so much for taking your time to help me. It helps a lot.
    However, the last shift (26th of August in this example) is not completely right. The extended weekend night rate should only be valid until 8 AM. After 8 AM there will be a standard rate again.
    How would I add a time restriction to these formulas saying that after 8 AM there will always be a day rate again?

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,532

    Re: Calculation of inconvenient working hours

    The following is based on my understanding of the manually provided values in the file attached to post #5 as well as the Cat C rule under step 2 in post #1.
    In the 8/26 example cell J9 yields a result of 9 hours for working from 11:00 PM on Sunday night until 8:00 AM on Monday morning. The other hour, 8:00 AM to 9:00 AM isn't being counted.
    To test the formula change E9 from 9:00 AM to 10:00 AM and notice that there is no change in cell J9. Then change C9 from 11:00 PM to 10:00 PM and notice that the J9 displays 10 (because Cat C starts at 6:00 PM on a weekend).
    Let us know if you have any questions.

  9. #9
    Registered User
    Join Date
    08-24-2016
    Location
    Birmingham, England
    MS-Off Ver
    2016
    Posts
    11

    Re: Calculation of inconvenient working hours

    i cant seem to make this work for my requirements.

    Cat A would be Night shift - 20:00 - 06:00
    Cat B would be Day shift - 06:00 - 20:00
    Cat C would Be Sat shift - Midnight Friday - Midnight Saturday
    Cat D would Be Sun Shift - Midnight Saturday - Midnight sunday

    i have the Cat A calculating Nights correctly but i can't seem to figure out how to make the rest work?
    any suggestions

  10. #10
    Registered User
    Join Date
    08-15-2018
    Location
    Stovkholm, Sweden
    MS-Off Ver
    2016
    Posts
    5

    Re: Calculation of inconvenient working hours

    Thank you for taking your time. I actually think we have a solution now, thanks to your help!

  11. #11
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,532

    Re: Calculation of inconvenient working hours

    You're Welcome and thank you for the feedback. Please take a moment to mark the thread as 'Solved' using the thread tools drop down in the ribbon above your first post. 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] Working hours calculation
    By john55 in forum Excel General
    Replies: 6
    Last Post: 01-27-2017, 08:10 AM
  2. [SOLVED] Calendar Day & Working Hours Day Calculation
    By Shermaine2010 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-17-2016, 09:34 AM
  3. Normal working hours calculation by day
    By harignz in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-26-2015, 12:32 AM
  4. [SOLVED] Working hours Calculation
    By match.chan in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-22-2015, 04:11 AM
  5. Working hours calculation problem
    By Villalobos in forum Excel General
    Replies: 1
    Last Post: 02-14-2015, 04:45 PM
  6. Working Hours in a Working Week Calculation
    By amasson in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-25-2014, 11:09 AM
  7. Working hours calculation with 4 times
    By IKZOUHETNIETWETEN in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-10-2013, 07:32 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