View Single Post
 
Old 07-17-2012, 07:30 AM
TimTDP TimTDP is offline Windows 7 64bit Office 2010 32bit
Advanced Beginner
 
Join Date: Apr 2012
Posts: 47
TimTDP is on a distinguished road
Default DateDiff gives error when working after 24 hours

In an Excel 2010 spreadsheet I have the following
Cell A1 = 17/06/2010 11:55:43 PM
Cell A2 = 17/06/2010 11:58:43 PM
Cell A3 = 18/06/2010 12:01:43 AM

Cell B1 = 1
Cell B2 = =IF(DATEDIF(A2,A1,"d")=0,B1,B1+1)
Cell B3 = =IF(DATEDIF(A3,A2,"d")=0,B2,B2+1)

The formula in cell B2 returns the correct answer 1, but cell B3 returns a #NUM! error. It should be 2. I think it is because the entry in cell A3 is the next day to cell A3

How do I get the formula to work in cell B3?

I manually enter 1 into cell B2. I then want to look at the next cell in column A. If the date, excluding the time) is the same as the previous cell in column A, then the corresponding cell in column B is the same. If not, I want to add 1 to the previous cell in column B

Thanks in advance
Reply With Quote