+ Reply to Thread
Results 1 to 4 of 4

Hi & Rounding down time when the calculated time is negative

  1. #1
    Registered User
    Join Date
    04-12-2016
    Location
    Belgium
    MS-Off Ver
    Ms Office Professional Plus 2016
    Posts
    10

    Hi & Rounding down time when the calculated time is negative

    Hi guys,
    I'm new to the forum, so a shot introduction is in place I suppose. I'm from Belgium, 34 years old and using excel 2014. I always thought I understood excel pretty well, though it seems I'm not always right.:-s

    The reason for registering is of course because I've got a question. :-)

    I'm calculating time in a sheet for workers on the floor and working time. All times are rounded down to the lowest 15 mins. Ie if a person works from 07:00 to 17:00 (1 hour noon break): he has worked 8 hours. If he stops at 17:14, the result is the same, but if he works to 17:16, the total worktime will show 8:15 worked. So far, no problems.
    Workers can however work more than 8 hours (with a max of 9) or less, with a minimum of 6 hours. These "sliding" times need to be registered. I've got no issue with registering the extra times, but when calculating the times which show a negative time (ex. someone has worked 6h45), the result isn't coming in.

    My sheet shows times when they batch in in the morning and the time when they batch out in the evening, the outcome can be 1 of following:
    1. the outcome is higher than 1 hour: this should give 1 hour (this one is solved) as no more than 1 extra hour can be registered
    2. the outcome is lower than 2 hours: this should give -2 hours (this is also solved) as no ore than -2 "extra" hours can be registered
    3. The outcome is between +1 and -2 hours: this should give the extra time (= total worked time - 8 hours standard working time) rounded down to the lowest 15 mins.

    Currently the formula I've got is: =IF(TIME(HOUR(H75),FLOOR(MINUTE(H75),15),0)>$AA$71,$AA$71,IF(TIME(HOUR(H75),FLOOR(MINUTE(H75),15),0)<$Z$72,$Z$72,TIME(HOUR(H75),FLOOR(MINUTE(H75),15),0)))
    H75 shows the wroked time at the end of the day
    AA71 shows 01:00 (to refer to the max extra time to be registered)
    Z72 shows -02:00 (to refer to the min "extra" time to be registered
    This formula works fine as long as the outcome isn't between -2:00 and 00:00. The I get a #Number error.

    Hopefully this is still clear for all, but if any questions for inclarities,s please state same.
    Thanks in advance for your expertise.
    Regards,
    Last edited by MrMaster; 04-13-2016 at 02:15 AM.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Hi & Rounding down time when the calculated time is negative

    I am not understanding the issue. Perhaps after seeing the workbook, it will make more sense. Please attach the workbook. Thanks.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Hi & Rounding down time when the calculated time is negative

    First, I believe we can simplify that formula greatly.

    =MEDIAN($AA$71,TIME(HOUR(H75),FLOOR(MINUTE(H75),15),0),$Z$72)


    Now desling with negative times, basically according to Excel there is no such thing as negative time. We can't travel back in time.
    The trick then is to not treat the value as a time in the first place.

    Your basic function there is
    TIME(HOUR(H75),FLOOR(MINUTE(H75),15),0)

    Instead, try
    =FLOOR(H75*1440,15)/1440


    So try
    =MEDIAN($AA$71,FLOOR(H75*1440,15)/1440,$Z$72)

  4. #4
    Registered User
    Join Date
    04-12-2016
    Location
    Belgium
    MS-Off Ver
    Ms Office Professional Plus 2016
    Posts
    10

    Re: Hi & Rounding down time when the calculated time is negative

    Hi guys,
    Thanks for your reply's. As I'm posting from a workspace a lot of internet access is blocked. I can't upload my workbook for example. :-s. Grmbl.
    In any case, before I even read your comments today, I already solved the issue and changed some things around in my workbook. This thread can therefore be closed and treated as solved.
    Nevertheless, thanks a lot for your feedback.
    Best regards,

+ 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. Replies: 8
    Last Post: 01-10-2014, 03:43 AM
  2. User error in rounding a calculated time frame
    By mnmmusicman in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-21-2013, 04:15 PM
  3. Cannot get calculated time to equal inputted time
    By HBF in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-03-2008, 02:37 PM
  4. Converting military time to decimal time not rounding correctly
    By Sean Anderson in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-23-2008, 09:12 PM
  5. Negative time should be allowed in Excel, eg time difference
    By Bengt-Inge Larsson in forum Excel General
    Replies: 2
    Last Post: 10-13-2005, 08:05 AM
  6. Rounding Time Intervals to the Nearest Specified Time Increment
    By ExcelTip in forum Tips and Tutorials
    Replies: 0
    Last Post: 08-23-2005, 12:21 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