+ Reply to Thread
Results 1 to 3 of 3

Hours a staff member works each day formula returning unexpected result

  1. #1
    Forum Contributor
    Join Date
    08-20-2009
    Location
    Plymouth, England
    MS-Off Ver
    Excel 2013
    Posts
    149

    Hours a staff member works each day formula returning unexpected result

    Hi all,

    I'm working on a work rota.

    I have written a formula which works out how many additional hours a staff member works each day. However in some circumstances the formula is returning a negative result when I'm expecting a 0 return.

    I've attached the file with notes. Apologies for my untidy formulas in advance!

    Many thanks,

    Luke
    Attached Files Attached Files

  2. #2
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Formula returning unexpected result

    Not sure about this, but I have the feeling that the following is happening.
    Internally time is represented by a number with 15 decimals. Apparently sometimes these numbers (like with 22:00 hrs) are rounded to 15 decimals, but somehow the remaining decimals are still there.
    Now 22:00 hrs is represented by the 0,916666666666667 which (because ending with 67) looks like being rounded upwards. So actually smaller than represented.
    What you then get is 0,916666666666667 (22:00) minus 0,770833333333333 (18:30) minus 0,145833333333333 (3:30) should leave 0 but in fact leaves -0,0000000000000000832667268468867. Being the difference between the representation of 22:00 hrs and it's actual value.

    Solution is pretty simple:
    Please Login or Register  to view this content.
    Cheers!
    Tsjallie




    --------
    If your problem is solved, pls mark the thread SOLVED (see Thread Tools in the menu above). Thank you!

    If you think design is an expensive waste of time, try doing without ...

  3. #3
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Hours a staff member works each day formula returning unexpected result

    Hi,

    The above is definitely a nice simple solution to this so I would use that, but just thought I'd say the section in the middle of your formula that refers to the Hours Matrix worksheet could be replaced with an INDEX/MATCH to automatically look up the values you're manually referring to. This would negate the need to adjust each formula individually as you could just write one and then copy it to all the other cells.

    You could also turn the two nested IFs at the start into an IF/OR.

    BSB.

+ 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] A formula to work out hours on a staff rota
    By bigtiger1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-30-2013, 07:23 PM
  2. [SOLVED] Long variable returning unexpected result which appears to be only integer value
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-05-2013, 10:59 AM
  3. SUBSTITUTE formula giving unexpected result
    By gkeller81 in forum Excel General
    Replies: 15
    Last Post: 06-04-2012, 01:16 PM
  4. Cell formula result unexpected when blank date criteria entered
    By TGP in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-06-2010, 07:59 AM
  5. Replies: 1
    Last Post: 07-06-2009, 07:07 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