Reputation: 59
I want to calculate difference of second date (year) and first date(year). I cannot write formula in excel.
if(quitDate is not empty)
{
quitDate - startDate
}
else
{
presentDate - startDate
}
I know only these two formulas =YEAR(NOW)-YEAR(A1) and = YEAR(B1)-YEAR(A1)
Upvotes: 1
Views: 381
Reputation: 59495
I suggest:
=IF(quitDate<>"",quitDate-startDate,NOW()-startDate)
where I have used Named Ranges (each one cell) for the two dates. I imagine you would prefer to replace those with suitable A1
references to make copying easier.
Upvotes: 1