+ Reply to Thread
Results 1 to 15 of 15

Calculating Target Date/Time Based on Start date and hours - Excel 2007

  1. #1
    Registered User
    Join Date
    02-27-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    77

    Calculating Target Date/Time Based on Start date and hours - Excel 2007

    Hi,
    I need a help to calculating Target date and time based on start date/time and hours. I'm explaining in detail below,

    In cell A2 having start date with time(format: mm/dd/yyy hh:mm)
    In cell B2 having total hours to complete the task(format: integer)

    If we updating the above values in respective cells, automatically cell C2 calculate the End Date with time.
    Please note that:
    * the end date should exclude weekends(Saturday and Sunday), public holidays(defined in cell range D2:D10) and off working hours(i.e: Business hours of the working day is 10:00AM to 06:00PM)
    * The end date should not shows as after 06:00 PM of the date

    I need a solution with excel formula or vba macro with loop(preferred)

    Thanks in advance,

    -Chinraj-

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Calculating Target Date/Time Based on Start date and hours - Excel 2007

    Please search the forum ( particularly posts by Daddylonglegs). This has been asked and solved numerous times

  3. #3
    Registered User
    Join Date
    02-27-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: Calculating Target Date/Time Based on Start date and hours - Excel 2007

    Thanks for the reply. I'm searching the forum. But not able to get exact requirement. Since most of the post are said calculating hours between two dates.. But my case is like calculating end date based on input date and hours.

    Please Help Me.

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Calculating Target Date/Time Based on Start date and hours - Excel 2007

    Quote Originally Posted by chinraj View Post
    In cell A2 having start date with time(format: mm/dd/yyy hh:mm)
    In cell B2 having total hours to complete the task(format: integer)
    ...public holidays(defined in cell range D2:D10)
    Assuming you also have start and end time of the working day (10:00 and 18:00 respectively in your case) in E2 and F2 then try this formula in C2

    =WORKDAY(A2,CEILING((B2/24+MOD(A2,1)-E$2)/(F$2-E$2),1)-1,D$2:D$10)+MOD(A2,1)+B2/24-CEILING(MOD(A2,1)+B2/24-E$2,F$2-E$2)+F$2-E$2

    format result cell to show time and date

    Start time/date must be within working hours
    Audere est facere

  5. #5
    Registered User
    Join Date
    02-27-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: Calculating Target Date/Time Based on Start date and hours - Excel 2007

    Thanks lot.. this is the thing i want.. it works perfect! awesome

  6. #6
    Registered User
    Join Date
    12-11-2013
    Location
    Indonesia
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Calculating Target Date/Time Based on Start date and hours - Excel 2007

    Hi daddylonglegs,

    I have similar question with chinraj, but in my case I have start time 08:00 and end time 17:00 and also break time from 12:00 to 13:00 (1 hour).
    Please help me.

    Thanks in advance,
    McNazar

  7. #7
    Registered User
    Join Date
    05-18-2017
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Calculating Target Date/Time Based on Start date and hours - Excel 2007

    Many thanks DaddyLongLegs! This is exactly the formula I need. I need to understand how it works by doing more research but having a working formula is a big help!

  8. #8
    Registered User
    Join Date
    09-01-2018
    Location
    Bangalore
    MS-Off Ver
    2016
    Posts
    7

    Re: Calculating Target Date/Time Based on Start date and hours - Excel 2007

    Daddylonglegs Can't thank you enough for this. I have one small issue with the very same formula and I wanted to know your thoughts on this.
    The enddate & time does not calculate correctly if the time is 2:00 PM and the duration is 4 hours. Let me explain...

    StartDate&Time = 24 Sep 2:00 PM
    Duration = 4 hours
    WorkHours is 10:00 to 18:00

    EndDate&Time shows as 25 Sep 10:00 AM instead of 24 Sep 06:00 PM

    I'm racking my brains over this and can't figure out why it doesn't calculate correctly for 2:00 PM (any other time between 6-18:00 works fine). Your help will be greatly appreciated.

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

    Re: Calculating Target Date/Time Based on Start date and hours - Excel 2007

    @praddsouza

    Welcome to the Forum, but please read the Forum Rules. You will see that Rule 4 states that you should not try to hijack a thread by posting your own question in it. Instead, you should start your own thread, with a link back to this one if you think it is necessary.

    Also, you do realise that the thread is over 4 years old?

    Pete

  10. #10
    Registered User
    Join Date
    09-01-2018
    Location
    Bangalore
    MS-Off Ver
    2016
    Posts
    7

    Re: Calculating Target Date/Time Based on Start date and hours - Excel 2007

    Pete_UK I apologize, I was under the assumption that if the solution provided doesn't work in the normal scenario then I need to use the same thread to inform the user who provided the solution. My bad, will start a new thread.

  11. #11
    Registered User
    Join Date
    12-07-2019
    Location
    India
    MS-Off Ver
    2016
    Posts
    3

    Re: Calculating Target Date/Time Based on Start date and hours - Excel 2007

    Hi Guys,

    Please help me. I would like to create a reminder sheet for my employees.

    But the below formula which was provided by expert daddylonglegs is counting before the working hour


    Cell A2 has TIme and Date :
    Example1 : 12/9/2019 09:00 (Monday 9PM)


    Cell B2 has 4 (Integer)

    Cells E2 and F2 has working hours 10:00 & 19:00 Respectively

    Using the below formula in C2 is giving me Result as 12/9/2019 13:00

    It should give me 12/9/2019 14:00 because the business hour starts at 10:00 AM. So the target deadline should be counting from the business hour

    HALP !


    Formula : =WORKDAY(A2,CEILING((B2/24+MOD(A2,1)-E$2)/(F$2-E$2),1)-1,D$2:D$9)+MOD(A2,1)+B2/24-CEILING(MOD(A2,1)+B2/24-E$2,F$2-E$2)+F$2-E$2

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

    Re: Calculating Target Date/Time Based on Start date and hours - Excel 2007

    See Post #9, and note that the thread is now a year older.

    Pete

  13. #13
    Registered User
    Join Date
    12-07-2019
    Location
    India
    MS-Off Ver
    2016
    Posts
    3

    Re: Calculating Target Date/Time Based on Start date and hours - Excel 2007

    Pete_UK


    Hi Pete,

    Can you provide me with the link, I'm new here

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

    Re: Calculating Target Date/Time Based on Start date and hours - Excel 2007

    The post number is shown on the extreme right in each dark blue banner, so just scroll up to see Post #9.

    Pete

  15. #15
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Calculating Target Date/Time Based on Start date and hours - Excel 2007

    Just to explain what Pete was referring to...
    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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] Calculate number of hours from Start date and time and End date and time
    By sathyasun in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-28-2013, 01:04 AM
  2. Calculating END time based on start time, breaks, and hours to complete
    By sweedey in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-01-2012, 11:29 AM
  3. Calculate START date based on duration (work hours) and END date
    By kaaver in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-06-2010, 12:21 PM
  4. Calculate start date based on working hours and end date
    By kaaver in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-28-2010, 06:58 AM
  5. Calculating days & time left from start date/time to end date/time
    By marie in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-07-2005, 10:40 AM

Tags for this Thread

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