Consulting

Results 1 to 6 of 6

Thread: Solved: Timesheet Weekly Totals Help

  1. #1
    VBAX Regular
    Joined
    Mar 2008
    Location
    Texas
    Posts
    19
    Location

    Solved: Timesheet Weekly Totals Help

    This is going to be difficult to explain. Here goes. I have a summary sheet with accumulated time for the week. For simplicity I'm using A1:A4 for this example:

    Cell A1 = Hours worked (hh:mm)
    Cell A2 = Paid time off (hh:mm)

    Cell A3 = Total Regular Time (hh:mm)

    Cell A4 = Total Overtime hours (hh:mm)

    Here's the issue. Only "Worked" hours over 40 hours is considered Overtime, unless there's paid time off. An employee could actually have a total of 44 hours, but took 4 hours of Paid time off. So all 44 hours would be paid at regular time. Another example would be an employee worked 45 hours, but 4 hours were taken as paid time off, so:

    Cell A3 (Regular Time) should equal 44 hours (but shown in minutes)
    Cell A4 (Overtime) should equal 1 hour (but shown in minutes)

    I don't think a formula will can do what I need and would like to see if vba can do it.

  2. #2
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,058
    Location
    This would be a piece of cake to Bob... if he was awake.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  3. #3
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,058
    Location
    This is as close as I can come. It may give you an idea.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Formulae do it stnding on their heads

    Total mins regular

    =(MIN(A1,1+TIME(16,0,0))+A2)*24*60

    Total mins overtime

    =(((A1-A2)*24>40)*((A1-A2)*24*60-2400))
    ____________________________________________
    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
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    The second can be simplified

    =MAX(0,(A1-A2)*24-40)*60
    ____________________________________________
    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

  6. #6
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,058
    Location
    Geez Bob, a shot across the bow would have been nice...... I got to return this ship to the owners in the morning ...... how am I going to explain the the hole amidships?
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Posting Permissions

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