+ Reply to Thread
Results 1 to 7 of 7

Calculate Date Difference in terms of Hours

  1. #1
    Forum Contributor wedzmer's Avatar
    Join Date
    06-13-2014
    Location
    Philippines
    MS-Off Ver
    2016
    Posts
    407

    Calculate Date Difference in terms of Hours

    I'm trying to help my brother who had this MS Excel assignment and I can't seem to get the right formula/logical argument for the conditions set in the problem.

    The Problem is stated as:

    "A car rental service posted a promo online where every vehicle will be rented for only $5 per day with $2 per hour if renter exceeds the prescribed period. If Alex Cooper rented a car at 7:00 AM of September 30 and returned it by 7:00 PM the following day, how much will he pay?"

    I placed A1 as Date of Release, B1 as Date Returned, C1 as Duration, D1 as Excess Hours, E1 as total.
    I got the duration simply by subtracting A1 and B1, but the excess hours doesn't seem to work correctly.
    Last edited by wedzmer; 10-03-2021 at 03:25 AM. Reason: typo error

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2010 on Linux - O365
    Posts
    12,509

    Re: Calculate Date Difference in terms of Hours

    I got the duration simply by subtracting C1 and B1
    I suppose you men subtracting A1 from B1 ?
    Perhaps try
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    in D1

  3. #3
    Forum Contributor wedzmer's Avatar
    Join Date
    06-13-2014
    Location
    Philippines
    MS-Off Ver
    2016
    Posts
    407

    Re: Calculate Date Difference in terms of Hours

    this will only compute the duration but not the excess hours, sir
    Last edited by AliGW; 10-03-2021 at 03:34 AM. Reason: PLEASE don't quote unnecessarily!

  4. #4
    Valued Forum Contributor
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    743

    Re: Calculate Date Difference in terms of Hours

    if C1 is a plain number, then try this in D1:
    Please Login or Register  to view this content.
    note: this assumes that C1 is where you enter the duration that is hired.

    if not, then without the duration hired for (the 8 hours) you can not do the calculation because who is to say how long it was hired for
    Last edited by janmorris; 10-03-2021 at 03:40 AM.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel (Windows 11 64-bit)
    Posts
    59,030

    Re: Calculate Date Difference in terms of Hours

    There are instructions at the top of the page explaining how to attach your sample workbook.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" to anyone who has offered you help in your thread. You can reward them by clicking on * Add Reputation below theur user name on the left, if you wish.


    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.

  6. #6
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Türkiye
    MS-Off Ver
    2010 - 64 Bit on Win7
    Posts
    939

    Re: Calculate Date Difference in terms of Hours

    Using Pepe Le Mokko's approach, I guess excess hours is;

    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Calculate Date Difference in terms of Hours

    Quote Originally Posted by wedzmer View Post
    this will only compute the duration but not the excess hours, sir
    I think you might need to review the MOD function which gives the remainder of a division so MOD(66,24)=18 for example

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Calculate Shift Hours (Date/Time difference in an interval)
    By seanpark22 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-28-2020, 04:39 PM
  2. Replies: 2
    Last Post: 08-07-2017, 06:25 PM
  3. Replies: 2
    Last Post: 08-06-2017, 08:54 PM
  4. Replies: 1
    Last Post: 09-13-2012, 05:50 AM
  5. Replies: 0
    Last Post: 09-13-2012, 05:28 AM
  6. Replies: 3
    Last Post: 12-23-2010, 04:46 PM
  7. calculate difference in time to hours
    By Chris in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-18-2005, 03:06 PM

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