Using date function in an if statement

M

M Smith

I need help using the date function in an if statement. I want cell A1 to
display a date 30 days ahead of the date typed into cell B1. I got this to
work using the Date funtion in cell A1. =DATE(YEAR(B1), MONTH(B1),
DAY(B1)+30)
However, if cell B1 is blank, I want cell A1 to be blank. If I use the
formula above cell A1 displays "1/30/1900". I tried using an if statement
but it bombs because of the commas in the DATE function
=IF(B1="","DATE(YEAR(B1), MONTH(B1), DAY(B1)+30)",""). Can anyone help me
with this.

I'm using Excel 2000 on Windows 2000.

Thanks
 
R

Ron Rosenfeld

I need help using the date function in an if statement. I want cell A1 to
display a date 30 days ahead of the date typed into cell B1. I got this to
work using the Date funtion in cell A1. =DATE(YEAR(B1), MONTH(B1),
DAY(B1)+30)
However, if cell B1 is blank, I want cell A1 to be blank. If I use the
formula above cell A1 displays "1/30/1900". I tried using an if statement
but it bombs because of the commas in the DATE function
=IF(B1="","DATE(YEAR(B1), MONTH(B1), DAY(B1)+30)",""). Can anyone help me
with this.

I'm using Excel 2000 on Windows 2000.

Thanks

In A1, use this formula:

=IF(B1="","",B1+30)

Format as a date.


--ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top