Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


share|improve this question

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:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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