+ Reply to Thread
Results 1 to 8 of 8

Adding hours to date/time with limits

  1. #1
    Forum Contributor
    Join Date
    07-17-2013
    Location
    Birmingham, England
    MS-Off Ver
    Excel for O365
    Posts
    197

    Adding hours to date/time with limits

    Hi all,

    Does anyone know how I would go about the following...

    If in cell A1, I have a date/time value of: 16/11/16 10:00
    If in cell B1, I have an hours value of: 08:00

    I can add the hours to the date/time by doing A1+B1 which will return the value of 16/11/16 18:00

    What if I wanted to set a time limit so I could only add hours up to 17:00 of any given day, and then recommence at 08:00 the following day?

    i.e... in the example above, I'm trying to add 8 hours but there is only 7 available up to 17:00 so the remaining 1 would be added to the following day resulting in a value of 16/11/16 09:00

    I'm sure it's possible but not sure how to go about it.

    Many thanks,

    Jason

  2. #2
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Adding hours to date/time with limits

    Do able but you need to outline your logic a bit more clearly please and specify the any given day statement.

  3. #3
    Forum Contributor
    Join Date
    07-17-2013
    Location
    Birmingham, England
    MS-Off Ver
    Excel for O365
    Posts
    197

    Re: Adding hours to date/time with limits

    Hi PFDave, thanks for the reply.

    Basically, it's for me to create a schedule of activities for planning work. So I would only want to use the hours of 08:00-12:00 & 13:00-17:00 of each workday (Mon-Fri).

    Some examples...

    Start: 16/11/16 08:00 Duration: 06:00 End: 17/11/16 15:00
    The duration is 6 hours which when added to the start would equal 14:00 as the end date, but I don't want to include the hour between 12:00 & 13:00, leaving only 8 hours with the remainder being completed after 13:00.

    Start: 16/11/16 08:00 Duration: 09:00 End: 17/11/16 09:00
    There are 9 hours between 08:00 & 17:00 which is equal to the duration, but I don't want to include the hour between 12:00 & 13:00, leaving only 8 hours with the remainder being completed the first hour of the next workday.

    Start: 18/11/16 14:00 Duration: 05:00 End: 20/11/16 10:00
    The start date is a friday at 14:00 with a 5 hour duration. 3 hours remaining of the day, with the final 2 hours completed on the next workday (Monday).


    As I've written that I realise it's more complicated than I first thought and am starting to see all kinds of trim, workday and if formulas.

    Hopefully I've not just made it more unclear!

  4. #4
    Forum Contributor
    Join Date
    07-17-2013
    Location
    Birmingham, England
    MS-Off Ver
    Excel for O365
    Posts
    197

    Re: Adding hours to date/time with limits

    Hi PFDave, thanks for the reply.

    Basically, it's for me to create a schedule of activities for planning work. So I would only want to use the hours of 08:00-12:00 & 13:00-17:00 of each workday (Mon-Fri).

    Some examples...

    Start: 16/11/16 08:00 Duration: 06:00 End: 17/11/16 15:00
    The duration is 6 hours which when added to the start would equal 14:00 as the end date, but I don't want to include the hour between 12:00 & 13:00, leaving only 8 hours with the remainder being completed after 13:00.

    Start: 16/11/16 08:00 Duration: 09:00 End: 17/11/16 09:00
    There are 9 hours between 08:00 & 17:00 which is equal to the duration, but I don't want to include the hour between 12:00 & 13:00, leaving only 8 hours with the remainder being completed the first hour of the next workday.

    Start: 18/11/16 14:00 Duration: 05:00 End: 20/11/16 10:00
    The start date is a friday at 14:00 with a 5 hour duration. 3 hours remaining of the day, with the final 2 hours completed on the next workday (Monday).


    As I've written that I realise it's more complicated than I first thought and am starting to see all kinds of trim, workday and if formulas.

    Hopefully I've not just made it more unclear!

  5. #5
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Adding hours to date/time with limits

    What's the most hours for duration? could this involved multiple weekends?

  6. #6
    Forum Contributor
    Join Date
    07-17-2013
    Location
    Birmingham, England
    MS-Off Ver
    Excel for O365
    Posts
    197

    Re: Adding hours to date/time with limits

    As I'll be recording tasks/activities at a very low level, I would think the longest duration would be no more than 5 days so no it wouldn't cross multiple weekends.

    Thank you!

  7. #7
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Adding hours to date/time with limits

    OK bear with me and I'll have think, I've done something similar recently, however working out the duration of working hours for multiples sets as opposed to forecasting the end date or due date so I'll see what I can make out.

  8. #8
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Adding hours to date/time with limits

    A2 is your start time, B2 is the duration and finally E2 should be your desired due date.

    Let me know how it looks.
    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] Adding hours to start time - Business hours/holidays/weekends
    By Thunderer in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-21-2014, 01:09 PM
  2. Adding time (more than 24 hours) to date time stamp
    By sidapt in forum Excel General
    Replies: 6
    Last Post: 01-06-2014, 04:08 AM
  3. [SOLVED] Adding Hours to Date + Time Text Data
    By ExcelQuestFL in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-23-2012, 01:39 PM
  4. Adding Working Hours To Date / Time
    By excelnube84 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-14-2012, 04:22 AM
  5. Replies: 0
    Last Post: 04-16-2012, 05:47 AM
  6. Replies: 0
    Last Post: 04-16-2012, 04:31 AM
  7. adding days/hours automatically to date time using a macro
    By dexter87 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-11-2011, 08:26 PM
  8. Adding date/time/hours
    By Stan_ in forum Excel General
    Replies: 1
    Last Post: 09-17-2010, 05:11 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