+ Reply to Thread
Results 1 to 4 of 4

Calculate time difference based on working hours

  1. #1
    Registered User
    Join Date
    03-30-2017
    Location
    Chennnai
    MS-Off Ver
    2016
    Posts
    2

    Calculate time difference based on working hours

    Cell A1 has the start Date and time
    Cell B1 has the End date and time
    Cell C1 has the person name: A or B or C
    A's working hours is 8 am to 5 pm, B's working hours is 11 am to 8 pm, C's working hours is 5 pm to 2 am

    In cell A2, i need to calculate the time difference between A1 and B1 (B1-A1) considering the person's name in cell C1 and their working hours.

    Example:
    A1= Start date and time: 3/30/2017 6 PM
    B1= End date and time: 3/31/2017 1:30 PM
    if C1 = person B
    the time difference in A2 should be: 4:30 hours (since B's working hours is 11 am to 8 pm)
    and vice versa..

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

    Re: Calculate time difference based on working hours

    Hello stanlyj and Welcome to Excel Forum.
    The following proposed solution is dependent on a helper range which is located in D1:I3 of the attached file, but which could be moved to an out of the way part of the spreadsheet and/or hidden for aesthetic purposes.
    In the helper range the following formulas are used to calculate time worked from Start of shift to End of Job and End of Shift to Start of Job respectively:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    The SUM function then populates A2. Solution was tested with values for A, B and C given the start and end dates given, however I would suggest a more rigorous testing.
    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.

  3. #3
    Registered User
    Join Date
    03-30-2017
    Location
    Chennnai
    MS-Off Ver
    2016
    Posts
    2

    Re: Calculate time difference based on working hours

    Hi JeteMc, Thank you for your reply. I've attached the excel sheet with my requirement. can u add formula for that..
    I've drop down list of person's name in column D, and in column C i need to get the working hours details automatically based on the name i select from the drop down list.
    Their shift timings are mentioned in columns G to I.
    Attachment 510031
    Attached Files Attached Files

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

    Re: Calculate time difference based on working hours

    This proposed solution employs two helper columns which could be moved to an out of the way portion of the worksheet, such as columns XFC:XFD, and/or hidden for aesthetic purposes. The formulas for the two helper columns respectively are:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    A SUM based formula populates column C, working hours.
    Let us know if you have any questions.
    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. Calculate lead time based on available working hours
    By Nu2Java in forum Excel General
    Replies: 6
    Last Post: 07-11-2014, 03:04 PM
  2. [SOLVED] Calculate time for working hours when start time falls outside of working hours
    By SKDY_Beau in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-20-2014, 12:50 PM
  3. Replies: 1
    Last Post: 09-13-2012, 05:50 AM
  4. Replies: 0
    Last Post: 09-13-2012, 05:28 AM
  5. Replies: 3
    Last Post: 12-23-2010, 04:46 PM
  6. [SOLVED] Calculate difference in time spanning a day, during office hours o
    By frozenfusion in forum Excel General
    Replies: 1
    Last Post: 08-26-2005, 06:05 AM
  7. [SOLVED] calculate difference in time to hours
    By Chris in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-18-2005, 03:06 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