Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

increment date in Excel 1

Status
Not open for further replies.

tizwaz

Technical User
Aug 8, 2002
437
GB
Can anyone help me - I need to have a formula which will add either 1 year or 3 years to the dates in a column dependant on the value in another column. I'm assuming an If statement for the first part but don't know how to do the rest
 
OK - sorry update to this question - I have got it working using the following
=IF((OR(A2="Hardware/server",A2="Hardware/laptop")),DATE(YEAR(B2)+3,MONTH(B2),DAY(B2)),DATE(YEAR(B2)+1,MONTH(B2),DAY(B2))) - however there are some rows which have no date. How can I build in that if the date is blank to not return anything?
 
=IF(ISBLANK(A2),"",IF(OR(A2="Hardware/server",A2="Hardware/laptop"),DATE(YEAR(B2)+3,MONTH(B2),DAY(B2)),DATE(YEAR(B2)+1,MONTH(B2),DAY(B2))))

--Lilliabeth
 
or shorter
[tt]=IF(ISBLANK(A2),"",
DATE(YEAR(B2)+IF(OR(A2="Hardware/server",A2="Hardware/laptop"),3,1),
MONTH(B2),DAY(B2)))[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top