+ Reply to Thread
Results 1 to 8 of 8

how to calculate unsocial hours!

  1. #1
    Registered User
    Join Date
    01-02-2023
    Location
    Kettering, England
    MS-Off Ver
    Office 365
    Posts
    6

    how to calculate unsocial hours!

    Hi,

    I am doing a spreadsheet to calculate my hours worked and my pay. I have everything done that I need, but for one thing, I usually work 19:00 to 07:00, calculating these hours was no problem, however, I am paid a supplement between the hours of 18:00 to 06:00, so I only get this for 11 of the 12 hours worked. My question is, how do I get the spreadsheet to count how many of my worked hours fall in the unsociable hours time frame? So in one column I have my total hours and in another column I have a total of unsociable hours. Hope that all makes sense!

    Cheers
    Gavin

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,295

    Re: how to calculate unsocial hours!

    see big yellow banner - upload a workbook - far easier to give solution if we see the structure you are using.
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  3. #3
    Registered User
    Join Date
    01-02-2023
    Location
    Kettering, England
    MS-Off Ver
    Office 365
    Posts
    6

    Re: how to calculate unsocial hours!

    Hi, Thanks for the reply Torachan.

    Trying to calculate column G, hours worked between 18:00 and 06:00 first part I have entered it manually.

    Regards
    Gavin
    Attached Files Attached Files

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,604

    Re: how to calculate unsocial hours!

    Try this in G3:

    =IF(OR(D3="",E3=""),0,(MIN(E3,TIME(6,0,0))-MAX(D3,TIME(18,0,0))+(E3<D3))*24)

    then copy down.

    Hope this helps.

    Pete

  5. #5
    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,893

    Re: how to calculate unsocial hours!

    G3, copied down:

    =IF(D3="","",24*MOD(MIN(6/24,E3)-MAX(18/24,D3),1))

    was your expected answer in G14 (purple) incorrect??
    Attached Files Attached Files
    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

  6. #6
    Registered User
    Join Date
    01-02-2023
    Location
    Kettering, England
    MS-Off Ver
    Office 365
    Posts
    6

    Re: how to calculate unsocial hours!

    Thanks Pete and Glenn. Both ways work equally well and Glenn, the answer in G14 was spot on. now all I have to do is chose which one to use, and feel guilty that someone has taken the time to do this to help me out and I'm not using their formula! And if I ever bump into either of you, the coffee is on me

    Cheers guys

  7. #7
    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,893

    Re: how to calculate unsocial hours!

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

  8. #8
    Registered User
    Join Date
    01-02-2023
    Location
    Kettering, England
    MS-Off Ver
    Office 365
    Posts
    6

    Re: how to calculate unsocial hours!

    Done, thank you very much

+ 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. Replies: 7
    Last Post: 08-15-2022, 07:33 AM
  2. [SOLVED] Help me with formula to correctly calculate unsocial hours worked
    By DekG in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 02-13-2022, 07:36 PM
  3. Replies: 1
    Last Post: 07-29-2021, 05:19 PM
  4. Replies: 3
    Last Post: 05-25-2020, 11:49 AM
  5. [SOLVED] Time Sheet which works out number of hours worked unsocial
    By Dan107 in forum Excel General
    Replies: 4
    Last Post: 09-08-2015, 12:28 PM
  6. [SOLVED] Calculate hours with predefined Working Hours and Weekend Hours
    By garciapliz in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-05-2013, 11:17 AM
  7. Replies: 7
    Last Post: 03-31-2013, 03:09 PM

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