You are viewing limited content. For full access, please sign in.

Question

Question

Calculate Age into YR/MO

asked on January 4, 2018

I am trying to calculate the age of a piece of equipment and display as Year/Month.  I am currently using the formula =DATEDIF(Manufacturer_Date,NOW(),"y") & "/" & DATEDIF(Manufacturer_Date,NOW(),"ym").  However, it does not calculate correctly.  It displays months with a negative digit (see below).  Can someone help me fix my formula?

0 0

Answer

SELECTED ANSWER
replied on January 4, 2018 Show version history

Hi Vanessa

Couple of things I have found

You need to use TODAY() instead of NOW

Also, I have found I can only use the "Y","M", and "D" qualifiers (Year, Month and Day) as MD, YM and YD haven't worked for me in the past

Using this approach, I used DATEDIF to calculate the Years and total months (subtracting the Years (12 months) off of the total months to give you the actual Years and remaining Months as you were looking for

You formula would be

=DATEDIF(Manufacturer_Date,TODAY(),"Y")&"/"&SUB(DATEDIF(Manufacturer_Date,TODAY(),"M"),PRODUCT(DATEDIF(Manufacturer_Date,TODAY(),"Y"),12))

0 0
replied on January 4, 2018

That worked perfect! Thank you! smiley

0 0
replied on January 4, 2018

Thanks Vanessa

FYI, NOW() does work as well, I just tested it, same results

=DATEDIF(ManuDate,NOW(),"Y")&"/"&SUB(DATEDIF(ManuDate,NOW(),"M"),PRODUCT(DATEDIF(ManuDate,NOW(),"Y"),12))

0 0

Replies

replied on January 4, 2018 Show version history

I had the same frustration with datedif, it does not seem to work.  This earlier post had the solution.
You will need something more like (for the month part)  =FLOOR(MOD((Manufacturer_Date)/365.25,1)*12,1)

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.