+ Reply to Thread
Results 1 to 3 of 3

Sum night shift working hours

Hybrid View

  1. #1
    Registered User
    Join Date
    07-10-2021
    Location
    Teslic, Bosnia and Herzegovina
    MS-Off Ver
    2021
    Posts
    32

    Sum night shift working hours

    Hi.

    So lets see. My example contains, for each day of the month (June 2022), the start and end time of example worker's shift. So, 07 14 means he worked 7 hours, but 21 07 means he worked night shift (10 hours).

    What I'd like are the following formulas:

    1) Total hours in day shift
    2) Total hours in night shift
    3) Total hours - Sundays only
    3) Total night shift hours on Sundays

    In fact, it's Sunday and I'm working night shift now.


    Thanks very much in advance.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    07-10-2021
    Location
    Teslic, Bosnia and Herzegovina
    MS-Off Ver
    2021
    Posts
    32

    Re: Sum night shift working hours

    OK, I've done half of work:

    1) Total hours in day shift:

    =SUMPRODUCT((LEFT(C4:AD4;2)<RIGHT(C4:AD4;2))*1;-IFERROR(VALUE(LEFT(C4:AD4;2));0)+IFERROR(VALUE(RIGHT(C4:AD4;2));0))

    2) Total hours in night shift

    =SUMPRODUCT((LEFT(C4:AD4;2)>RIGHT(C4:AD4;2))*1;24-IFERROR(VALUE(LEFT(C4:AD4;2));0)+IFERROR(VALUE(RIGHT(C4:AD4;2));0))


    Both are array formulas (Ctrl + Shift + Enter)

  3. #3
    Registered User
    Join Date
    07-10-2021
    Location
    Teslic, Bosnia and Herzegovina
    MS-Off Ver
    2021
    Posts
    32

    Re: Sum night shift working hours

    Wow, I solved it myself:

    3) Total hours - Sundays only

    =SUMPRODUCT(IFERROR(IF(VALUE(LEFT(C4:AG4;2))<VALUE(RIGHT(C4:AG4;2));VALUE(RIGHT(C4:AG4;2))-VALUE(LEFT(C4:AG4;2));24+VALUE(RIGHT(C4:AG4;2))-VALUE(LEFT(C4:AG4;2)));0)*(IFERROR(WEEKDAY(DATE(2022;6;C3:AG3);11);0)=7))

    4) Total night shift hours on Sundays

    =SUMPRODUCT(IFERROR(IF(VALUE(LEFT(C4:AG4;2))<VALUE(RIGHT(C4:AG4;2));VALUE(RIGHT(C4:AG4;2))-VALUE(LEFT(C4:AG4;2));24+VALUE(RIGHT(C4:AG4;2))-VALUE(LEFT(C4:AG4;2)));0)*(IFERROR(WEEKDAY(DATE(2022;6;C3:AG3);11);0)=7)*(LEFT(C4:AG4;2)>RIGHT(C4:AG4;2)))


    Array formulas (Ctrl + Shift + Enter)



    Cheers to the good people who read my problem.
    Attached Files Attached Files

+ 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] How to calculate night shift hours?
    By jane_dm7 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-04-2023, 09:52 AM
  2. [SOLVED] HOURS whats the difference of DAY hours & NIGHT hours per SHIFT formula
    By StephanRS in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-06-2021, 02:35 PM
  3. [SOLVED] How to calculate regular work hours and night shift hours?
    By Kris Rinser in forum Excel General
    Replies: 7
    Last Post: 03-31-2021, 08:04 AM
  4. [SOLVED] Calculate Night Shift Hours
    By unknown87s in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 06-03-2020, 09:57 AM
  5. Shift - Day and Night, working hours out
    By fwddesign in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-05-2016, 09:06 PM
  6. [SOLVED] Spliting Day Shift and Night Shift Hours
    By Goldbadger2 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-27-2013, 01:16 AM
  7. Replies: 4
    Last Post: 09-21-2012, 12:58 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