Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

excel year to decimal

Status
Not open for further replies.

autex

Technical User
Jan 11, 2005
75
US
how do i get excel to calculate the exact difference between two dates? datediff() is wierd, the diff between 12/31/2001 and 1/1/2002 is one year. months is similar where it's possible for a difference of one day to equal one month. I've thought about converting from days, but then you got leap year to worry about.

What function would you use to calculate the difference between a date in an excel cell and a date entered by the user on a user form?
 
Divide the number of days by 365.245

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I thought about that, but that's not exact for obvious reasons. It does work if I round to 2 decimals. let me ask: why 365.245 and not 365.25?
 
Because year ending with 00 aren't leap except if multiple of 400.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 

Pardon me, but a date is just a number representing the number of days from a base year (1900 or 1904). So the number of days between two dates is just
[tt]
=DATE1-DATE2
[/tt]
(Round or truncate as appropriate if there is any time component.) Or what am I missing?
 
Or what am I missing
I think the OP want a decimal number of year...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top