Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / December 2007

Tip: Looking for answers? Try searching our database.

Elapsed period between dates

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Robin Clay - 12 Dec 2007 22:35 GMT
Greetings !

Excel will give the number of days between two given dates, provided both
are post 1/1/1900.

For Family History research, I would like to obtain the time between dates
for periods going back to the 1600s !

e.g., I would like to interogate my database to find the ages at marriage of
my ancestors.

O.K, I guess to the nearest month would be accurate enough !

Regards

Robin
JLGWhiz - 12 Dec 2007 22:56 GMT
You can take a look at these sites.  Maybe they will help.

http://j-walk.com/ss/excel/files/xdate.htm

http://support.microsoft.com/kb/214058

> Greetings !
>
[quoted text clipped - 12 lines]
>
> Robin
Robin Clay - 12 Dec 2007 23:27 GMT
Thank you for your help.
Signature

Regards

Robin

> You can take a look at these sites.  Maybe they will help.
>
[quoted text clipped - 18 lines]
> >
> > Robin
sebastienm - 12 Dec 2007 23:09 GMT
Hi,
Excel doesn't handle dates prior to 1900. When you enter such a date in a
sheet, eg. 1/1/1600, it is entered as text (left aligned while regular dates
are right aligned).
On the other hand , vba and MS Access handles dates prior to 1900.

-You could either keep your data in an MS Access table and query from excel.
- or you could wrap the regular vba functions into vba to make it a UDF
useable in a sheet. Eg regular vba DateDiff --> DateDiff2 for the sheet:
Public Function DateDiff2( _
   Interval As Variant, Date1 As Variant, Date2 As Variant) As Variant
  Dim d1 As Date, d2 As Date
 
  On Error Resume Next
  d1 = CDate(Date1)
  d2 = CDate(Date2)
  If Err <> 0 Then ''' error converting dates
     DateDiff2 = CVErr(xlErrValue)
  Else
     DateDiff2 = DateDiff(Interval, d1, d2)
     If Err <> 0 Then ''' error for Interval
        DateDiff2 = CVErr(xlErrValue)
     End If
  End If
End Function

DateDiff2 works llike vba DataDiff, but it can also be used in the sheet, eg:
   =DateDiff("m",A1,A2)
--> returns the number of months between dates in A1 and A2. Even if these
dates are in the 1600s and therefore understaood as Text by excel, when
passed to the function , they are converted to regular dates and the
computation can then work.

Signature

Regards,
Sébastien
<http://www.ondemandanalysis.com>

> Greetings !
>
[quoted text clipped - 12 lines]
>
> Robin
Robin Clay - 12 Dec 2007 23:28 GMT
Thank you for your help.
Signature

Regards

Robin

> Hi,
> Excel doesn't handle dates prior to 1900. When you enter such a date in a
[quoted text clipped - 45 lines]
> >
> > Robin
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.