MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Using a date in a IF-statement

Posted by Michael on September 19, 2001 12:02 AM

If cell A1="08:00:00", the formula :
returns 0 !!!

So, what am I doing wrong ?
I've tried with different (time)formats in A1, but nothings helps.

with regards

Posted by Richard S on September 19, 2001 12:20 AM


I'm pretty sure that by putting "05:00:00" in your formula, Excel isn't recognising it as a time, but as text. If you put "05:00:00" in cell B1 and change your formula to
it will return 1.


Posted by Michael on September 19, 2001 12:31 AM

You're absolutely right Richard,
it works if I'm using a cell in my formula !
Thnx :-)

Posted by Aladin Akyurek on September 19, 2001 1:02 AM

However, you might occasionally need to use a constant like 05:00:00 directly in the formula. In that case, to overcome the trouble Richard pointed out, you'd use e.g.,