+ Reply to Thread
Results 1 to 34 of 34

Calculate time remaining based on end date & time and current date

  1. #1
    Registered User
    Join Date
    10-25-2012
    Location
    Northamptonshire
    MS-Off Ver
    Excel 2010
    Posts
    54

    Unhappy Calculate time remaining based on end date & time and current date

    Hi, this is my very first post so apologies if I do not enter this correctly but this is the issue I have:

    I have a 2010 excel spreadsheet where I have the following columns:

    Start Date - entered manually
    End Date - which has a formula based on the start date & time plus 48 hours =C4+G$1 to automatically popolute this field. I need to copy the formula down the spreadsheet but would like the end date column to be blank if the start date field is empty. Additionally, the formula needs to exclude weekends and holidays.

    Time Remaining - needs to automatically show the time remaining based on the end date & time and current date & time excluding weekends and holidays.

    C4 = End Date above
    G$1 = set hours i.e. 24:00, 36:00 or 48:00 ect. This will be a set number of hours for every row to determine the end date and time


    Any help would be greatly appreciated as I am pulling my hair out now :-( I have seen formulas containing MOD and MEDIAN but I don't understand what these are and how they work.

  2. #2
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Calculate time remaining based on end date & time and current date

    Hi,
    For end date to be blank, when start date is blank, you can use =if(Start_Date="","",Your_Formula)

    For time remaining, you can explore NetWorkDays formula

  3. #3
    Registered User
    Join Date
    10-25-2012
    Location
    Northamptonshire
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Calculate time remaining based on end date & time and current date

    Hi,
    The blank cells were great now, thanks, but how do I exclude weekends and holidays from the formula.

    I have also tried using the NetWorkDays formula but I must be doing something wrong as I just get a lot of ######### as the answer.

    Thanks,
    Kaz

  4. #4
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Calculate time remaining based on end date & time and current date

    Networkdays works like this =Networkdays(Start_Date,End_Date,Holidays_Range)

    You can store holidays date in a range and use it in the formula. Networkdays automatically excludes Saturday and Sunday. If you still dont get it, share a dummy workbook.

  5. #5
    Registered User
    Join Date
    10-25-2012
    Location
    Northamptonshire
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Calculate time remaining based on end date & time and current date

    Thanks for your help. I have attached the dummy workbook for you to look at.

    Thanks,
    Kaz
    Attached Files Attached Files

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

    Re: Calculate time remaining based on end date & time and current date

    The end date can be obtained with
    Please Login or Register  to view this content.
    which will exclude week ends and holidays

  7. #7
    Registered User
    Join Date
    10-25-2012
    Location
    Northamptonshire
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Calculate time remaining based on end date & time and current date

    Wow, that's great - thank you. Now I just need to resolve the time remaining column to incorporate working hours.

    Thank you very much
    Kaz

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

    Re: Calculate time remaining based on end date & time and current date

    Does this help ? ( haven't checked the results I'm afraid)


    Copy of Calculation to show time remaining-2.xlsx

  9. #9
    Registered User
    Join Date
    10-25-2012
    Location
    Northamptonshire
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Calculate time remaining based on end date & time and current date

    That's really great. The only thing I noticed is that when you reach the end date & time the formula still shows a time remaining figure, from where I don't know. It would be great that if you have passed the end date and time the cell just shows zero. Is this at all possible - sorry to be a nuisance.

    Thanks,
    Kaz

  10. #10
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Calculate time remaining based on end date & time and current date

    Try this formula, if your problem is not resolved yet.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    10-25-2012
    Location
    Northamptonshire
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Calculate time remaining based on end date & time and current date

    Hi
    Thank you for coming back. When you have passed the date and time the cell sits at zero, which is what I need but unfortunately it does not calculate the remaining live hours correctly. See attached spreadsheet - row 8.

    Any help would be appreciated.

    Thanks,
    Kaz
    Attached Files Attached Files

  12. #12
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Calculate time remaining based on end date & time and current date

    Hi,

    The values given in column C are correct answers? For row 8, it is showing zero. The formula i have given also showing zero.

  13. #13
    Registered User
    Join Date
    10-25-2012
    Location
    Northamptonshire
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Calculate time remaining based on end date & time and current date

    Hi,
    The rows above row 8 have a different formula in column C that calculates the remaining hours but when it gets to 00:00 it starts to count upwards again once the end date and time have passed. When this point has been reached I just want it to sit as 00:00 hours remaining.

    With the formula you gave that is shown in row 8 it does not calculate the remaining time correctly based on the difference between NOW() and column B End Date and Time. What your formula does do is it sits at 00:00 time remaining if there is no time remaining between NOW() and End Date and Time, which is correct but if there is remaining time I need this to calculate the actual remaining time.

    Thanks in advance for your kind help and support.

    Kindest regards
    Kaz

  14. #14
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Calculate time remaining based on end date & time and current date

    Then can you provide the answers to the rows in your sheet.. by freezing now() to a particular time.. so that i can check where it is going wrong..

  15. #15
    Registered User
    Join Date
    10-25-2012
    Location
    Northamptonshire
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Calculate time remaining based on end date & time and current date

    Sorry, how do I freeze now()?

    Thanks,
    Kaz

  16. #16
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Calculate time remaining based on end date & time and current date

    What i mean is, say as on today 13:00, what should be time remaining.. Since now keeps changing, you can provide a stable answer to me rite..

  17. #17
    Registered User
    Join Date
    10-25-2012
    Location
    Northamptonshire
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Calculate time remaining based on end date & time and current date

    Hi,

    I have replaced the now()with cell H10, which has a set date and time in it. As you can see the formula has not calculated the correct time remaining. Time remaining should be 6:40 and not 9:30.

    Thanks,
    Kaz
    Attached Files Attached Files

  18. #18
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Calculate time remaining based on end date & time and current date

    Check this one..
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  19. #19
    Registered User
    Join Date
    10-25-2012
    Location
    Northamptonshire
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Calculate time remaining based on end date & time and current date

    Wow, this is fantastic. I didn't think it was possible what I wanted. You are the best and this is the best forum I have been on. What a great start for a first time user. Thank you so very much for your hard work, I really appreciate it.

    Kindest regards,
    Karen

  20. #20
    Registered User
    Join Date
    10-25-2012
    Location
    Northamptonshire
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Calculate time remaining based on end date & time and current date

    How can I amend the last formula from Sindhus to show the cells in column C (Time Remaining) as blank if there is nothing in column A (start date) otherwise the cells in column C show #VALUE! until column A has a date and time entered.

    Many thanks,
    Kaz
    Last edited by Kaz09; 10-26-2012 at 11:31 AM.

  21. #21
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Calculate time remaining based on end date & time and current date

    The same way as given in post 2.. if(Start_Date="","",Your_Formula)

  22. #22
    Registered User
    Join Date
    10-25-2012
    Location
    Northamptonshire
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Calculate time remaining based on end date & time and current date

    Sorry, when I trying add the above ..if(start_date="","",my_formula) it doesn't like it. Would you mind writing it exactly as it should be I must be doing something wrong

    Thank you
    Kaz

  23. #23
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Calculate time remaining based on end date & time and current date

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  24. #24
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Calculate time remaining based on end date & time and current date

    Hi just now checked, if today's date is in holiday's list there is an issue. Fixed the formula.. check this..
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  25. #25
    Registered User
    Join Date
    10-25-2012
    Location
    Northamptonshire
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Calculate time remaining based on end date & time and current date

    Hi,
    So sorry to be a pest, I now have the blanked out cells until a date/time is entered in to column A but the remaining time calculation has gone wrong as you can see from the highlighted rows in yellow. Rows 17 & 18 with the new formula are showing the incorrect time remaining.

    Thanks,
    Karen
    Attached Files Attached Files

  26. #26
    Registered User
    Join Date
    10-25-2012
    Location
    Northamptonshire
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Calculate time remaining based on end date & time and current date

    Sorry, added the wrong spreadsheet. This is the correct one.

    Thanks

  27. #27
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Calculate time remaining based on end date & time and current date

    Check the formula in D column. Used named formulas to avoid confusion.

  28. #28
    Registered User
    Join Date
    10-25-2012
    Location
    Northamptonshire
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Calculate time remaining based on end date & time and current date

    Hi,

    Thanks for the formula - it works a treat. I noticed that you have used what looks like to me some hidden named fields such as Is_Today_Holiday, which is why I am struggling to use the formula on a new workbook. How can I create the named fields to match my new workbook.

    Kindest regards,
    Kaz

  29. #29
    Registered User
    Join Date
    10-25-2012
    Location
    Northamptonshire
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Calculate time remaining based on end date & time and current date

    Hi,
    Just to confirm I have managed to copy over the formulas using the Name Manager field so now everything seems to be okay.
    Many thanks for all your support and patience.
    Kindest regards,
    Kaz

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

    Re: Calculate time remaining based on end date & time and current date

    I use some generic formulas to get working hours between 2 date/times - this version will give you the working hours left between now and B2, if B2 is in the past the formula returns zero

    =IF(B2="","",MAX(0,(NETWORKDAYS(TODAY(),B2,holidays)-1)*(G$7-F$7)+IF(NETWORKDAYS(B2,B2,holidays),MEDIAN(MOD(B2,1),G$7,H$7),G$7)-MEDIAN(NETWORKDAYS(TODAY(),TODAY(),holidays)*MOD(NOW(),1),G$7,F$7)))

    where F7 and G7 define the Mon-Fri start and end times and holidays is a named range containing holiday dates
    Audere est facere

  31. #31
    Registered User
    Join Date
    10-25-2012
    Location
    Northamptonshire
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Calculate time remaining based on end date & time and current date

    Hi daddylonglegs,

    Should H$7 in the formula above be F$7 (start time) otherwise what does H$7 refer to?

    Many thanks,
    Kaz

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

    Re: Calculate time remaining based on end date & time and current date

    Quote Originally Posted by Kaz09 View Post
    Should H$7 in the formula above be F$7
    Yes, that was a typo, apologies, it should be F$7

  33. #33
    Registered User
    Join Date
    10-25-2012
    Location
    Northamptonshire
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Calculate time remaining based on end date & time and current date

    Thank you, that works really well and very easy to use. Thank you for taking time out to help me resolve my query.

    Kindest regards,
    Kaz

  34. #34
    Spammer
    Join Date
    08-18-2014
    Location
    https://t.me/pump_upp
    MS-Off Ver
    2007
    Posts
    1

    Re: Calculate time remaining based on end date & time and current date

    Hi, this is my very first post so apologies if I do not enter this correctly but this is the issue I have:

    I want to calculate the remaining time between the now time and end time. the formula i use is Time Now() minus Time End
    I get an answer of 19:26:28 this is not correct considering the start time is 12:00 and the duration is 05:12.

    Please advise how I can fix this.

    Thanks
    Rand_32

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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