I have an excel sheet with an auto date calculator function linked to each cells. I want this function to work based on different condition. For eg: (lets say there are two conditions A and B)for condition A (I will put A in A1 cell), I want the date function to be [DATE(YEAR(B2), MONTH(B2), DAY(B2)+5)] and for condition B (I will put B in A2 cell), I want the date function to be [DATE(YEAR(B2), MONTH(B2), DAY(B2)+10)]. Is this possible to do in excel on one sheet based on whichever condition I enter? Thanks a lot.

Nupur

link|improve this question
feedback

1 Answer

From your description, A and B are not necessarily mutually exclusive as you are putting them in different cells. So it is not clear what should happen if A1=A and A2=B. If you meant them both to be in A1 then:

=IF(A1="A",DATE(YEAR(B2), MONTH(B2), DAY(B2)+5), IF(A1="B",DATE(YEAR(B2), MONTH(B2), DAY(B2)+10),""),"")

However, you don't really need all that DATE(...) stuff, since you can just add numbers to dates like this:

=IF(A1="A",B2+5),IF(A1="B",B2+10),""),"")
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.