+ Reply to Thread
Results 1 to 5 of 5

Alter numeric values by size

  1. #1
    Registered User
    Join Date
    04-12-2007
    Posts
    10

    Alter numeric values by size

    Hi.

    Apologies in advance for the novice nature of the question!

    I'm currently trying to create a rota timesheet which automatically takes shift patterns and deducts for unpaid breaks.

    Basically if a shift is less than 4.5 hours long then no break is deducted
    If the shift length is 4.5 - 6.5 hours then 15 mins are deducted
    If the shift is longer than 6.5 hours then 30 mins are deducted

    I've left the file as an attachment - if you can suggest a better way to code such a program I would also be grateful.

    Thanks in advance for any help/advice you can spare.

    Jason.
    Attached Files Attached Files
    Last edited by lengjay; 11-12-2009 at 10:36 PM. Reason: <SOLVED>

  2. #2
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191

    Re: Need code for automatically altering numeric values based on their size

    Try
    Please Login or Register  to view this content.
    in F2. You can get rid of columns D and E and the matrix tab then.

  3. #3
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Need code for automatically altering numeric values based on their size

    This looks ugly, but it works

    example formula for Mel's shift in F22

    =C22-B22-LOOKUP(C22-B22,{0,0.1875,0.270833},{0,0.0104166666666667,0.0208333333333333})

    Format as h:mm to get time format or multiply by 24 to get decimal hours.
    Last edited by teylyn; 11-12-2009 at 09:44 PM.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Need code for automatically altering numeric values based on their size

    Or to get rid of all the decimals, =C2-B2 - LOOKUP(C2-B2, {0,4.5,6.5} / 24, {0,15,30} / 1440)
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    04-12-2007
    Posts
    10

    Re: Need code for automatically altering numeric values based on their size

    Really really thank you for all your help guys! Slowly getting there!

    <SOLVED>

+ 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