+ Reply to Thread
Results 1 to 13 of 13

Calculate late penality

  1. #1
    Registered User
    Join Date
    12-27-2012
    Location
    Melbourne
    MS-Off Ver
    Excel 2010
    Posts
    19

    Calculate late penality

    Hi,
    I thought I had my formula working, but after further testing is doesn't.

    I am trying to calculate a late shift penality in cell AL7. Basically if an employee works between 19 and midnight then for any hours which fall into this period should be paid $1.65 for every hour worked.
    Start time is in cell M7, finish time is in cell N7, total hours worked is in cell P7. The $1.65 is in cell AL5.

    The formula I have so far, which I can't seem to get to work is =IF(AND(M7<19,N7>19),((N7-19))*$AL$5,IF(AND(M7>=19,N7<=24),Z7*$AL$5,0))

    Can anyone help solve this please.

    Cheers
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Calculate late penality

    In AL5 use this formula and drag down.

    Please Login or Register  to view this content.
    Last edited by kvsrinivasamurthy; 02-07-2013 at 02:49 AM.

  3. #3
    Registered User
    Join Date
    12-27-2012
    Location
    Melbourne
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Calculate late penality

    Thank you, but it doesn't work...

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Calculate late penality

    Hi

    1 think to remember about time is that excel treats time as a fraction/decimal of a day. So, for instance, 06:00 is actually 0.25 of a day, 08:00 is 1/3 of a day, midday is 0.5 of a day, and so on.

    With that said, try changing your formulas to something like this....

    instead of M8<19 use M8<TIME(19,0,0) etc

    Hope that helps?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Calculate late penality

    Pl see the attached file.
    Attached Files Attached Files

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Calculate late penality

    I saw your file, and you have been offered a suggestion on how to work out what you need. Did you even try the suggestion yet?

  7. #7
    Registered User
    Join Date
    12-27-2012
    Location
    Melbourne
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Calculate late penality

    Hi there,

    Thank you for your help and I see that your solution works, however I can't have it in time values.

  8. #8
    Registered User
    Join Date
    12-27-2012
    Location
    Melbourne
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Calculate late penality

    Hi FDibbins,

    I looked at the solution that KV has provided. I see that it works when it has been converted to time, but I can not have it in time format, as we use this sheet to upload into our payroll system which can't accept time formats. so if an employee works 7 hours 30 minutes it needs to be 7.5 or 7.25 of it was 7 hours 15 minutes and so on

  9. #9
    Forum Expert icestationzbra's Avatar
    Join Date
    01-07-2004
    MS-Off Ver
    2007, 2010
    Posts
    1,421

    Re: Calculate late penality

    see if this helps in AL1504 (because that is where i found test data), drag-filled down to AL1516:

    UPDATE:

    Please Login or Register  to view this content.
    Last edited by icestationzbra; 02-09-2013 at 11:27 PM. Reason: fixed for times saddling the fence
    - i.s.z -
    CSE, aka Array aka { }, formulae are confirmed with CONTROL+SHIFT+ENTER.
    Replace commas ( , ) with semicolons ( ; ) in formulae, if your locale setting demands.
    All good ideas are courtesy resources from this forum as well as others around the web.
    - e.o.m -

  10. #10
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Calculate late penality

    If M & N columns are number formatted (Eg 19:30 hrs is shown as 19.5) the following formula may be suitable.See attached file.


    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by kvsrinivasamurthy; 02-09-2013 at 03:49 AM.

  11. #11
    Registered User
    Join Date
    12-27-2012
    Location
    Melbourne
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Calculate late penality

    Hey all,

    Thank all you for your suggestions, but just as with my formula as soon as an employee works past midnight, the formula doesn't calculate. so if the start time is 19, but the finish is 1am, the formula doesn't calculate anything, which is the same problem I have with my original formula

  12. #12
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Calculate late penality

    Try This In AL7 and drag down.


    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    12-27-2012
    Location
    Melbourne
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Calculate late penality

    Thank you all for your assistance here. It is greatly appreciated with all the great suggestions we have managed to get it to work.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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