Need help with a project sheet, need date to show/not show based o

  • Thread starter Thread starter Max
  • Start date Start date
M

Max

Hello,

I have the following formula in cell S2
=IF(B2="","",DATE(YEAR(B2),MONTH(B2),DAY(B2)+31))
This takes a date in cell B2 and adds 31 days to it and displays it.

What I need to do is to NOT have cell S2 show any date if anything is in
cell D2.

I'm not very adept at Vis Basic if that what it will take to do it.

Thanks
Max
 
Hi,

No need for code

=IF(OR(B2="",D2<>""),"",DATE(YEAR(B2),MONTH(B2),DAY(B2)+31))

Mike
 
In order to add ONE full month to a date [if this is your intension] I would
suggest using: =EDATE(B2,1)
Check your formula against the above
PS: You may need to install the Analysis Toolpak if you are using Excel ver.
prior to 2007.
Micky
 
Mike,

Initially it worked the opposite of what I wanted it to do, but after
changing the <> to a = it seems to work fine.

Thanks for your help!
 
You can also shorten your formula to:
=IF(OR(B2="",D2=""),"",B2+31)

Regards,
Fred.
 
Back
Top