View Full Version : Compare dates in Excel
walt17
Mar 12, 2013, 11:51 AM
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?
ebaines
Mar 12, 2013, 12:21 PM
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.
walt17
Apr 10, 2013, 12:05 PM
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.
ScottGem
Apr 10, 2013, 03:07 PM
What version of Excel? There should be nothing to interfere with a formula like that? What results do you get?
ebaines
Apr 11, 2013, 05:55 AM
Also make sure that the cells are properly formatted as dates or numbers.
walt17
Apr 12, 2013, 10:57 AM
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.