In 1 cell, combine difference of years/months from 2 dates

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Using a start and end date, how do you find the difference of years/months in
one cell. (ex. 3.2 years)
 
stellie said:
Using a start and end date, how do you find the difference of years/months in
one cell. (ex. 3.2 years)

You should use the DateDiff function. It would look something like:

datediff("yyyy",[StartDate],[EndDate])
OR
datediff("m",[StartDate],[EndDate])

where [StartDate] and [EndDate] are the fields containing your dates.
The "yyyy" is used to find out the number of years and the "m" is to
find the number of months.

Look up the DateDiff function in help if you need more information.

Keven
 
Try this --
Int(DateDiff("m",[Date open],[date close])/12) & " Years and " &
DateDiff("m",[Date open],[date close])-(Int(DateDiff("m",[Date open],[date
close])/12)*12) & " months"
 
Hi Stellie

=DateDiff("yyyy",[StartDate],[EndDate]) & " total years " &
DateDiff("m",[StartDate],[EndDate])-(DateDiff("yyyy",[StartDate],[EndDate])+Int(Format([EndDate],"mmdd")<Format([StartDate],"mmdd")))*12 & ", months."

This will give you XX total years, XX months. (in words)


=DateDiff("yyyy",[StartDate],[EndDate]) &
DateDiff("m",[StartDate],[EndDate])-(DateDiff("yyyy",[StartDate],[EndDate])+Int(Format([EndDate],"mmdd")<Format([StartDate],"mmdd")))*12

This will give you XX XX

Hope this is helpful
 
If you use =DateDiff("yyyy",[StartDate],[EndDate])
Hi Stellie

=DateDiff("yyyy",[StartDate],[EndDate]) & " total years " &
DateDiff("m",[StartDate],[EndDate])-(DateDiff("yyyy",[StartDate],[EndDate])+Int(Format([EndDate],"mmdd")<Format([StartDate],"mmdd")))*12 & ", months."

This will give you XX total years, XX months. (in words)


=DateDiff("yyyy",[StartDate],[EndDate]) &
DateDiff("m",[StartDate],[EndDate])-(DateDiff("yyyy",[StartDate],[EndDate])+Int(Format([EndDate],"mmdd")<Format([StartDate],"mmdd")))*12

This will give you XX XX

Hope this is helpful

--
Wayne
Manchester, England.
Not an expert.
Enjoy whatever it is you do.



stellie said:
Using a start and end date, how do you find the difference of years/months in
one cell. (ex. 3.2 years)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top