Date comparision

M

Murray

Hi
I have a simple problems that is hopefully easy to answer.
is it possible to compare two dates eg =if(27/03/2006 < 13/10/2006,....)
if so can someone please advise.
Thanks
 
R

Roger Govier

Hi Murray

Try either
IF(DATE(2006,3,27)<DATE(2006,10,13), value_if_true,value_if_false)
or
IF(--"27/03/06"<--"13/10/06", value_if_true,value_if_false)
 
B

Brendan Vassallo

You could also try

IF(cell_ref1<cell_ref2,value_if_true,value_if_false)

This is possible as excell converts dates to numbers in the background

Brendan
 
C

CurtB

If all you want to do is compare a date in one cell to a date in another
cell, just do a value comparison. Dates are stored as a numerical value.

If Range("A1").Value < Range("A2").Value Then
<date in A1 is before date in A2>
Else
<date in A1 is same as or after date in A2>
End If
 
Top