+ Reply to Thread
Results 1 to 13 of 13

Time calculator returning negative result until punch-out is recorded?

  1. #1
    Forum Contributor
    Join Date
    01-09-2016
    Location
    USA,USA
    MS-Off Ver
    2016
    Posts
    1,192

    Time calculator returning negative result until punch-out is recorded?

    I have a timesheet calculator and when you enter in 8:00 AM then the formula that calculates the hours worked enters -8.00. Once you put in a clock out time then it corrects itself, but why is it doing -8?

    e.g.

    In / Out / Hours
    8:00 / / -8.00
    8:00 / 12:00 / 4.00

    Workbook is attached that shows the -8.00. I know I could make the formula just be blank until the second entry but why does it return a negative prematurely?
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Time calculator returning negative result until punch-out is recorded?

    One way, in F7, copied down:

    =IF(E7="",24*MAX((C7-B7),0),(MAX((C7-B7),0)+(E7-D7))*24)
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Time calculator returning negative result until punch-out is recorded?

    Since check out times are blank, Excel treats them as 0.
    0-8 is negative 8.
    1. Click on the * Add Reputation if you think this helped you
    2. Mark your thread as SOLVED when question is resolved

    Modytrane

  4. #4
    Forum Contributor
    Join Date
    01-09-2016
    Location
    USA,USA
    MS-Off Ver
    2016
    Posts
    1,192

    Re: Time calculator returning negative result until punch-out is recorded?

    Glenn can you help walk me through this.

    Are all you doing is adding essentially the MAX and therefore preventing it from going negative and instead return 0?

  5. #5
    Forum Contributor
    Join Date
    01-09-2016
    Location
    USA,USA
    MS-Off Ver
    2016
    Posts
    1,192

    Re: Time calculator returning negative result until punch-out is recorded?

    Mody, thank you.

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Time calculator returning negative result until punch-out is recorded?

    Yes, that's pretty much it. If the first end time is blank, the formula returns 0. If the secondf end time is blank, only the duration of the morning session will be returned. Only when the end times are added, will the formula show something other than zero.

  7. #7
    Forum Contributor
    Join Date
    01-09-2016
    Location
    USA,USA
    MS-Off Ver
    2016
    Posts
    1,192

    Re: Time calculator returning negative result until punch-out is recorded?

    Glen, Can you help out with another question regarding my same spreadsheet.

    I have the hours copied down to a row and then another row that rounds that for our time tracking software. Issue is that it isn't rolling over after 40 hours like it should. Instead it is SUM the regular hours and then rounding. Hard to explain sorry.

    Row 14 is true hours (same as F42:F48)
    Row 15 is OT hours based on row 14 (anything over 40)

    Row 17 is taking the matching cell in row 14 and rounding it. (it is reducing from two decimals to one)
    Row 18 is OT and is taking the matching cell in row 15 and rounding it. (it is reducing from two decimals to one)

    this issue is that when you round row 17 you may hit 40 hours quicker as some may round up. I attached another spreadsheet that will help explain better.

    I have the two rows because it is showing the employees what they really worked versus what they are to enter into our tracking software
    Attached Files Attached Files

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Time calculator returning negative result until punch-out is recorded?

    You have become yet another victim of rounding errors when adding/subtracting time in Excel.

    Change the formula in B14, and simlilarly across the rest of the row to:

    =ROUND(1440*MAX(0,MIN(40,SUM(F4:F4))-SUM(A14:A14)),0)/1440

    This removes rounding errors and both sets of figures add up to 40 hr.

  9. #9
    Forum Contributor
    Join Date
    01-09-2016
    Location
    USA,USA
    MS-Off Ver
    2016
    Posts
    1,192

    Re: Time calculator returning negative result until punch-out is recorded?

    Why can I not change it in B14 and drag?

    I was getting close darn it. I had the Round but not the 1440.

    I also am failing at your formula. I added it in and it doesn't seem to be helping.
    Attached Files Attached Files
    Last edited by taylorsm; 08-16-2018 at 01:20 PM.

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Time calculator returning negative result until punch-out is recorded?

    The way your formula is set up, the first term increments a row and the second a column. I thought that you had twigged that. It's not very nice, is it. It is (of course) fixable. Give me five minutes.

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Time calculator returning negative result until punch-out is recorded?

    Try this in B14, copied across. Check it carefully. i did get a bit confused about what you are trying to achieve. But.... I think it's OK:

    =ROUND(1440*MAX(0,MIN(40,SUM($F4:INDEX($F$4:$F$10,COLUMNS($A:A))))-SUM($A14:A14)),0)/1440

  12. #12
    Forum Contributor
    Join Date
    01-09-2016
    Location
    USA,USA
    MS-Off Ver
    2016
    Posts
    1,192

    Re: Time calculator returning negative result until punch-out is recorded?

    G18 is still saying .2 instead of .3.

    Row 14 is the number of hours worked to two decimals. Our punch clock rounds to two decimals however our accounting website (terrible) rounds only to one. Right now with two decimals you get 40 in row 14, but if you round up C17, D17, E17, F17,G17 then you get 40.1 like in row 17.

    Row 14 and Row 17 should cap at 40 hours with anything over (overtime) flowing into the next row.

    G17 should = 8.7
    G18 should = 0.3

    Does that make more sense?

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Time calculator returning negative result until punch-out is recorded?

    Gawd!!

    IF I follow what you had done... you had adjusted the formatting to make the numbers LOOK different. However, that doesn't change the underlying data. So... I went back to square 1 and re-did the calculations ROUNDING to 1 dp and 2. Cells shaded blue have all got nice new formulae that can be dragged across/down. Some of yours were very clunky and had to be adjusted ion a cell-by-cell basis. A few verification cells are shown in gold.

    I understand (and get) your expected answer.

    I did manage to muck up the date cells in column A, but I'm sure that you'll be able to fix that yourself.
    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] Need help with Punch in and Punch out clock system please.
    By Grassman in forum Excel Programming / VBA / Macros
    Replies: 74
    Last Post: 02-27-2020, 02:16 AM
  2. Elapsed time negative result
    By OllieKP87 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-02-2014, 02:30 PM
  3. Clock in multiple punch in/punch out times Formula
    By Schnizzle74 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-24-2014, 06:15 PM
  4. [SOLVED] Transpose the Punch Time
    By skandkamat in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-30-2013, 01:12 AM
  5. need one formula for returning positive or negative time w/out #######
    By completelyhis in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-11-2013, 09:12 AM
  6. Replies: 0
    Last Post: 10-12-2012, 07:57 AM
  7. Prevent Formula Returning Negative Result
    By Manic in forum Excel General
    Replies: 2
    Last Post: 11-09-2011, 11:27 AM

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