computing date to age

  • Thread starter Thread starter aboiy
  • Start date Start date
A

aboiy

Hellow guys,

ive used this formula in computing the years of service
from their hiring date.

=DATEDIF(L60,TODAY(),"Y")

Question # 1
the above formula works well, but when the hiring date is
less than a year it gives a "0" result, i know its normal
but can i incorporate instead if the hiring date is less
than a year, it will show a no.of days or a no.of months?

Question # 2
if column "L" encounter a blank cell, is it possible to
show a blank result? coz i noticed when it encounter a
blank cell it still give a result of "103" based on todays
date.

for your kind consideration.

thank you so much.

aboiy
 
Aboiy,

You can incorporate IF statements to achieve your desired results

=IF(L60="","",IF(DATEDIF(L60,TODAY(),"Y")<>0,DATEDIF(L60,
TODAY(),"Y") & " years",DATEDIF(L60,TODAY(),"YM") & " months"))

Logic
If L60 is blank leave the cell blank
If L60 is not blank
If the datedif formula produces a non-zero use the datedif "Y" formula
If the datedif formula produces a zero use the datedif "YM" formula

Dan E
 
Back
Top