+ Reply to Thread
Results 1 to 6 of 6

Calculating cost

  1. #1
    Registered User
    Join Date
    04-17-2009
    Location
    Ohio
    MS-Off Ver
    Excel 2002
    Posts
    6

    Calculating cost

    Okay this is probably easy pickins for those who actually know Excel. But for those of us struggling to learn - any help is appreciated.

    Problem - billing spreadsheet for prisoner fee.

    1 - 8 hrs = $55
    9 - 24 hrs = $55 + $65 or $120
    Anything over 24 hrs - $65 for each additional (24 hrs) ($185)

    So if you were locked up for 6 hrs it is $55. If you were locked up for 18 hrs it is $120. If you were locked up for 28 hrs it is $185. And if you were locked up for 49 hrs it is $250.

    Cell F5 contains number of hours locked up - I would like cell I5 to calculate the cost of the stay.

    I am proud of myself for figuring out the date and time subtraction - but this part has me stumped.

    Thanks in advance
    Last edited by TMCEWAN259; 04-17-2009 at 09:22 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Calculating cost

    Using embedded IF,

    I5: =IF(F5<=8,55,IF(F5<=24,120,185+(65*INT((F5-24)/24))))

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,020

    Re: Calculating cost

    or... =IF(D8<25;LOOKUP(D8;{0;9};{55;120});120+65*INT((D8-1)/24)) (edited)

    (edited2: Use DQ INT instead of ROUNDDOWN)
    Last edited by zbor; 04-17-2009 at 07:56 AM.
    Never use Merged Cells in Excel

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Calculating cost

    =if(and(f5>=1,f5<=8),55,if(and(f5>=9,f5<=24),120,if(f5>24,120+(floor(f5,24)/24)*65,"")))
    hmm lost that race! and prob used to many ands
    but three diferent ways of calculating > 24 interesting that
    edit
    ah its now dropped to 2
    Last edited by martindwilson; 04-17-2009 at 07:59 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  5. #5
    Registered User
    Join Date
    04-17-2009
    Location
    Ohio
    MS-Off Ver
    Excel 2002
    Posts
    6

    Re: Calculating cost

    My thanks - worked perfect. I can safely say I would NEVER have figured that one out. I appreciate the help!

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,020

    Re: Calculating cost

    Don't forget to make your thread [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