+ Reply to Thread
Results 1 to 8 of 8

Date Calculation

Hybrid View

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

    Date Calculation

    Okay I thought I had this thing licked but a new wrinkle has come up. In my original request I outlined that I was trying to calculate a billing issue based upon the number of hours someone was housed.

    A5= 1/1/2009 23:50 (Time Arrived)
    C5= 1/3/2009 12:10 (Time Left)
    F5 = Total Hours
    (Formula behind F5) =(+C5-A5)*24*60/60
    F5 is formatted as a general number
    A5 and C5 are formatted as custom m/d/yyyy h:mm

    In the example above F5 is 36. So now the folks using this spreadsheet tell me that they need it to display the hours AND minutes - because it impacts billing.

    H5 currently gives the billing amount based upon this formula
    =IF(F5<=8,55,IF(F5<=24,120,185+(65*INT((F5-24)/24))))

    So if they are here for exactly 48 hrs it is $185 but if they are here for 48 hours and 1 minute it goes to $250.

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

    Re: Date Calculation

    If you just want the result rounded up to whole hour, then in F5,

    =ceiling(24*(c5-a5), 1)
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Date Calculation

    Not sure where the problem is? Is it the result of $250 is wrong or is it that you need cell F5 to display hours and minutes? Please clarify.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

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

    Re: Date Calculation

    Yeah sorry about that - I do need it to display hours and minutes so they can verify the billing amount.

  5. #5
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: Date Calculation

    To calculate & display h:mm in f5 change formatting to [h]:mm
    change formula to =C5-A5
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

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

    Re: Date Calculation

    mudraker - okay I did that and indeed it does change the results in F5 to 36:11 - however now it totally throws the calculation in H5 out of whack. Prior to the change you suggest it shows up as the correct amount - $185 - after your change it goes to $55?
    Last edited by TMCEWAN259; 04-27-2009 at 09:26 AM.

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Date Calculation

    Now multiply each of the F5's in the H5 formula by 24:

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

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

    Re: Date Calculation

    NBVC - Mudraker - Thank you - will marked as solved - I have no mind for math or functions, thankfully others do. Much appreciated.

+ 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