If-statement (deal with date and time)

  • Thread starter Thread starter kaon
  • Start date Start date
K

kaon

Hi all,

What formula should I input into the cell if I want to check th
current date and time against a given date and time, i.e.

If current date and time equals a month (say, June)
then display a formula (say, = A1 + B2)
else 0

I have wrote such code:
= IF(MONTH(NOW()) = -a month- , -formula- , 0)
but it does not work.

I am using xl2000.

Thanks
 
The 'month()' function returns a number from 1-12, so make sure you
if() function checks for a number, not the name of the month.

Alternatively, you can define all your months as numbers elsewhere t
make them equal to values. Insert - Name - Define
 
Month returns a value between 1 and 12, so

=IF(MONTH(TODAY())=6,A1+B2,0)

will return A1+B2 if and only if the month is June (of any year).
 
Back
Top