View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Santa-D Santa-D is offline
external usenet poster
 
Posts: 34
Default DATEDIF formula enhancement

I've acquired this formula from the Excel 2002 Formula book by John
Walkenbach but I want to extend it's features by rounding it off.

The formula is as follows:

=DATEDIF(G7,H7,"y") & " years, " & DATEDIF(G7,H7,"ym") & " months, " &
DATEDIF(G7,H7,"md")+1 & " days"

G7 = 1/11/2006
H7 = 31/10/2016

The result is 9 years, 11 months, 31 days

What I want it to do is round it to 10 years.

The reason why I can't just go =DATEDIF(G7,H7,"y") & " years" is
because in the same spreadsheet the row above it is:

G7 = 1/03/2006
H7 = 15/11/2006

The result is 0 years, 8 months, 15 days.

I guess the best option would be to create a VBA function which calls
the datediff function?

Any suggestions?