Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Spreadsheets (https://www.askmehelpdesk.com/forumdisplay.php?f=395)
-   -   Compare dates in Excel (https://www.askmehelpdesk.com/showthread.php?t=738826)

  • Mar 12, 2013, 11:51 AM
    walt17
    Compare dates in Excel
    I want to compare two dates to see if the time between them is greater or less than a set time. Is there a formula to do that?
  • Mar 12, 2013, 12:21 PM
    ebaines
    You can simply use subtraction and the result is the difference in days. If you want the difference in hours multiply by 24. So for example if cell A1 is "3/24/2013 10:13:00 AM," and cel lA2 is "3/12/2013 5:14:00 PM," then A1-A2 results in 11.7076 days. If you multiply that by 24 you get 280.98 hours.
  • Apr 10, 2013, 12:05 PM
    walt17
    Thanks for your response. Your method is easier than the way I was trying to do it. It has taken awhile to get back because I did encounter a problem.

    In a clean sheet, it works fine. As does my more complex method. But in the spreadsheet I'm using, neither method works. Even if I retype other data in the relevant rows, it's a no go. There is evidently some invisible coding that is fouling up the works, but I have been unable to find out what and correct it.

    Fortunately, this isn't a frequent calculation so I'll keep doing it manually when needed.
  • Apr 10, 2013, 03:07 PM
    ScottGem
    What version of Excel? There should be nothing to interfere with a formula like that? What results do you get?
  • Apr 11, 2013, 05:55 AM
    ebaines
    Also make sure that the cells are properly formatted as dates or numbers.
  • Apr 12, 2013, 10:57 AM
    walt17
    Quote:

    Originally Posted by ebaines View Post
    Also make sure that the cells are properly formatted as dates or numbers.

    That was the key. Cells containing dates were properly formatted. But the results cell was formatted as text. Because that is what the ultimate answer will be. Changing results cell format to general makes it work.

    Thanks for the help.

  • All times are GMT -7. The time now is 09:49 AM.