+ Reply to Thread
Results 1 to 5 of 5

Help Return Value Based on Time in Two Different Cells

  1. #1
    Registered User
    Join Date
    02-28-2020
    Location
    New York
    MS-Off Ver
    2016
    Posts
    8

    Help Return Value Based on Time in Two Different Cells

    Hello and thanks,

    I believe there should be a simple solution to my Excel question.

    Say Cell A3 has a value of 5:00 AM and B3 has a value of 9:00 AM.

    Assume a work shift starts at 7:00 AM and ends at 4:30 PM, I am trying to do the following:

    Return the difference in hrs between A3 and B3 if A3 through B3 values fall between 700 am to 430 pm.so in this case the answer is 2 hrs (from 7 am to 9am occured within normal shift) and if A3:B3 time didnt occur between 7 to 430 retirn a value of 0.

    Can anyone assist? Thanks
    Last edited by LOK25; 02-28-2020 at 10:58 AM.

  2. #2
    Registered User
    Join Date
    01-09-2014
    Location
    Leeds, England
    MS-Off Ver
    Excel 365
    Posts
    72

    Re: Help Return Value Based on Time in Two Different Cells

    If you put the normal start time in E1, and the normal finish time in E2, you can use the following:

    =IF(OR(MAX(A3:B3)<E1,MIN(A3:B3)>E2),0,MIN(B3,E2)-MAX(A3,E1))

    This returns a 0 if the values fall outside normal times, otherwise it works out the time worked during "normal hours"

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Help Return Value Based on Time in Two Different Cells

    C3 =HOUR(B3-A3)-D3
    D3 =MAX(HOUR(B3)-16.5,0)+MAX(7-HOUR(A3),0)

    Format both cells as general.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  4. #4
    Registered User
    Join Date
    02-28-2020
    Location
    New York
    MS-Off Ver
    2016
    Posts
    8

    Re: Help Return Value Based on Time in Two Different Cells

    I couldn't get any of the suggested equations to work. Could this help?

    Work Schedule:

    Start Of Work Shift: Cell B3: 7:00 AM
    End of Work Shift: Cell C3: 4:30 PM

    Header: Depart Time Header 2: Arrival Time
    5:00 AM 9:00 AM

    So is there any equation to have Excel calculate the difference between Arrival and Depart Times that were in between the work shift? In this case, the 2 hours from 7:00 to 9:00 am?

    Thanks

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Help Return Value Based on Time in Two Different Cells

    Welcome to the forum

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

+ 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] Return a different number based on range that a time falls into
    By KoolKatelyn in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-31-2017, 10:47 AM
  2. Value at end of time series based on Rate of Return???
    By kwt890 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-11-2015, 12:03 PM
  3. Return the Earliest time in a range based on a min value
    By afgoody in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-24-2014, 01:21 AM
  4. [SOLVED] return value based on age at a given point in time
    By Kangaroo_Pouch in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-19-2013, 07:02 AM
  5. Return value based on closest time/date and name
    By Steven87 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-11-2013, 03:52 PM
  6. [SOLVED] Return indicated value based on time elapsed since specified date
    By edeneyes in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-15-2012, 10:53 AM
  7. Return a value based on a time range
    By cfreedman in forum Excel General
    Replies: 1
    Last Post: 07-01-2012, 02:16 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