Consulting

Results 1 to 12 of 12

Thread: Problems with calculating hours worked

  1. #1
    VBAX Regular
    Joined
    Nov 2007
    Location
    Liverpool
    Posts
    13
    Location

    Problems with calculating hours worked

    Hi we have a cheapskate Time & Attendance system which produces the attached report downloaded into excel. We them manually calculate the hours worked and send on to the payroll bureau. In this example, basic hours would be 7.5 and overtime at time and hallf would be 2hours.We only pay dble time at weekends. I would like to automate but am not sure how to calc the hours accurately.

    Standard hours on the dayshift are 8.00 am to 12.00 and 12.45 to 4.15pm

    Any early starts before 8.00 am are paid in 15 min blocks at time and a half.
    Any overtime after 4.15 is also paid in 15 min blocks at time and a half.

    Help!

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    This will calculate the standard hours

    =MIN(TIME(7,30,0),SUMPRODUCT(--(J14:J16)))

    overtime

    =ROUND((SUMPRODUCT(--(J14:J16))-K16)*96,0)/96

    is all weekends at double?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Nov 2007
    Location
    Liverpool
    Posts
    13
    Location
    Hi quick response very impressive. Just to complicate things .....
    Standard hours Saturday are 6.00am till 2 pm - first 4 hours at time + half remaining 4 at double time. Suinday std hours the same but all at double time. Just one question what is the significance of the 96 in your formula?

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    K16: =IF(WEEKDAY(F13,2)>=6,0,MIN(TIME(7,30,0),SUMPRODUCT(--(J14:J16))))

    L16: =MIN(TIME(4,0,0)-(WEEKDAY(F13)=1)*TIME(4,0,0)+(WEEKDAY(F13,2)<6)*TIME(12,30,0),ROUND((SUMPRO DUCT(--(J14:J16))-K16)*96,0)/96)

    M16: =MAX(0,ROUND((SUMPRODUCT(--(J14:J16))-K16)*96,0)/96-K16-L16)
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Expert
    Joined
    Aug 2007
    Location
    Windermere, FL, a 'burb in the greater Orlando metro area.
    Posts
    567
    Location
    Quote Originally Posted by Gusty
    ... Just one question what is the significance of the 96 in your formula?
    Since 96 is 4 * 24, I would intuit that this is getting you the 1/4 hour increments for O/T before/after regular/std hours.

    HTH,
    Ron
    Windermere, FL

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Correct!
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    VBAX Tutor david000's Avatar
    Joined
    Mar 2007
    Location
    Chicago
    Posts
    276
    Location

    To cover midnight shift, I think I saw a few.

    Change:
    Cover midnight shift!

    J14 to =MOD(H14-H13,1)
    J16 to =MOD(H16-H15,1)

    And hey xld ---

    I belive Sumproduct is optional in those right?
    regular Sum would work too.

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    No it wouldn't. The original workbook has text fields and

    =SUM(J14:J16)

    yields 0, and trying to corece text to numbers via

    =SUM(--(J14:J16))

    yields #VALUE, whereas SUMPRODUCT ....
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  9. #9
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    And where does a midnight shift come into it?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  10. #10
    VBAX Tutor david000's Avatar
    Joined
    Mar 2007
    Location
    Chicago
    Posts
    276
    Location
    And where does a midnight shift come into it?
    Oh, on sheet1 row 109 the dude started at 22:39:47

    In I thought is would be big trouble later so, well you know...and your right about SP I changed the text to number right of the bat sorry I did it without thinking.I went stright to the format [h]:00:00 in case of >24hrs then sum worked for ma at least.

  11. #11
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    It does with real numbers, the poster just had an odd worksheet.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  12. #12
    VBAX Tutor david000's Avatar
    Joined
    Mar 2007
    Location
    Chicago
    Posts
    276
    Location
    Still, that is THE best use of that double unary operator I?ve ever seen.
    Will use it!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •