Excel & dates... how to determine order.

A

antoinejon

Hi everyone:

I have a huge formula to figure out changing interest rates per year.
was wondering if anyone new of a function that did something lik
this:

A1 Cell is greater than (or is more recent than) 1-1-1992

I am using this for an if/then function, so if the date came before 9
then ####, if not, then it's zero. I already have that part of th
formula figured out, just so you know what I'm dealing with.

Please post any ideas, or if you have any questions.

Thank you!
antoin
 
B

BrianB

If you have formatted your columns as dates then the contents are jus
numbers (try one cell - Copy/Edit Paste Special Values).

You therefore use them the same as any other number
eg. IF(A1<B1,1,0)
To use a hard coded date in the comparison formula it needs to be se
to a number :-
eg. =IF(A1>DATEVALUE("1/1/92"),"After","Before")
=IF(YEAR(A1)<1992,"Before","After")

This is duplicated in code by If ....Then ... Else ..

Beware. VBA changes hard coded dates to the American format "mm/dd/yy"
especially if you use
MyDate=#31/1/92#
("it's a feature, not a bug" <grin>)
so you may need to ensure that you use something like .....
MyDate=Format("1/1/92","dd/mm/yy"
 
Top