Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

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),""),"")
share|improve this answer

Your Answer

 
discard

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.