+ Reply to Thread
Results 1 to 8 of 8

Excel not calculating time when 18:00 used and total is one hour or less

Hybrid View

  1. #1
    Registered User
    Join Date
    02-01-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    4

    Excel not calculating time when 18:00 used and total is one hour or less

    I have an Excel sheet that's calculating the difference between two times. Its very simple calculation that does not go past midnight.

    The formula I'm using is =INT((B1-A1)*24)

    This seems to work for most of the calculations, but when I use it against a time from 17:00 to 18:00 it will not calculate the difference. If the time is 16:00 to 17:00 it returns 1, If I use 18:00 to 20:00 it will return an answer of two. The input is formatted as time [hh]:mm, the output is formatted as General.

    Any help is greatly appreciated.

  2. #2
    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
    53,047

    Re: Excel not calculating time when 18:00 used and total is one hour or less

    Hi and welcome to the forum

    what exactly do you have in A1 and B1?
    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

  3. #3
    Registered User
    Join Date
    02-01-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Excel not calculating time when 18:00 used and total is one hour or less

    Hi,

    A1 and B1 are times using 24 hour clock and format of [hh]:mm
    So my problem is when I have 18:00 and try to take away 17:00, it returns a zero, if I Input 17:00 and take away 16:00 it works fine, something about 18:00 and a one hour gap is tripping it up.

    Thanks for the interest.

  4. #4
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: Excel not calculating time when 18:00 used and total is one hour or less

    You've encountered the rounding error from floating point arithmetic. Try this:

    =ROUND(B1-A1,5)*24
    Last edited by ConneXionLost; 02-03-2014 at 04:25 PM.
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

  5. #5
    Registered User
    Join Date
    02-01-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Excel not calculating time when 18:00 used and total is one hour or less

    Hi,

    That returns 24:00 when taking 17:00 from 18:00 ? My apologies if I'm missing something, I am trying to get a return of one hour

  6. #6
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: Excel not calculating time when 18:00 used and total is one hour or less

    Apologies, remove the "*24" from the formula.

  7. #7
    Registered User
    Join Date
    02-01-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Excel not calculating time when 18:00 used and total is one hour or less

    No need to apologise, mental arithmetic should have helped me there. Many thanks for providing the answer.

  8. #8
    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
    53,047

    Re: Excel not calculating time when 18:00 used and total is one hour or less

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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. Calculating Time Range of cells less than 1 hour
    By Bil4646l in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-22-2013, 09:23 PM
  2. [SOLVED] Calculating time on site from a 24 hour clock
    By jatacake in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 03-11-2013, 06:36 AM
  3. 24 hour clock calculating total hours using midnight
    By Wilgoss in forum Excel General
    Replies: 8
    Last Post: 09-06-2010, 11:53 AM
  4. Calculating Time across a 24 hour period
    By jmag in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 11-19-2007, 12:27 PM
  5. [SOLVED] Calculating a colmun to total a 40 hour work week
    By Harley mom in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-20-2005, 03:45 PM

Tags for this Thread

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