[mso] Re: Custom Date difference

  • From: Wilson Baptista Junior <wilson@xxxxxxxxxx>
  • To: mso@xxxxxxxxxxxxx
  • Date: Wed, 21 Jul 2004 09:21:45 -0300

Hi Robert,
You have to trap and check *any* zero values returned by DATE before using 
the DATEDIF function; using the formula I gave you, if there's a zero date, 
it means that the day, the month, the year, or any combination of these are 
??, so you can't know the exact date by the original data. In your example, 
for ????-??-?? DATE is returning a zero value, and a zero date value for 
Excel means that the date is 1900-Jan-00, since Excel computes dates 
serially by number of elapsed days, starting from the first day of 1900. 
With my formula, this will happen whenever day, month or year is 
non-numeric (in your case, ??).

Wilson


At 21:05 20/7/2004, Robert Carneal wrote:
>---COPY---
>assuming your dates are in the format YYYY-MM-DD, you can use
>          =DATE(LEFT(A1,4),MID(A1,6,2),RIGHT(A1,2))
>(assuming the date is in cell A1) to return the number used by Excel as
>the
>corresponding date.
>To get around the question marks, you might complete the formula as
>such:
>=IF(AND(ISNUMBER(VALUE(LEFT(A1,4))),ISNUMBER(VALUE(MID(A1,6,2)));ISNUMBE
>R(VALUE(RIGHT(A1,2)))),DATE(LEFT(A1,4),MID(A1,6,2),RIGHT(A1,2)),0)
>which will return the date if Year, Month and Day are numeric and return
>
>zero if any of them are not.
>---END---
>
>Whups, problem, at least on my end.
>
>Suppose:
>Birthdate in A1 is "????-??-??"
>Death date in B1 is "1987-03-20"
>
>The formula returns 1900-Jan-00 for the Birthdate in A1.
>The formula returns 1987-Mar-20 for the deathdate in B1
>
>Then, my age formula computes 87 years, 2 months, 0 days. Hmm, any
>suggestions? Would it work if I "trap" the 1900-Jan-00 dates and just
>have it enter "Nondeterministic" for the age?
>
>Thank you.
>
>Robert
>
>
>
>*************************************************************
>You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
>MicrosoftOffice@xxxxxxxxxxxxxxxx
>
>To send mail to the group, simply address it to mso@xxxxxxxxxxxxx
>
>To Unsubscribe from this group, send an email to
>mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) 
>in the subject line.
>
>Or, visit the group's homepage and use the dropdown menu.  This will also 
>allow you to change your email settings to digest or vacation (no mail).
>//www.freelists.org/webpage/mso
>
>To be able to use the files section for sharing files with the group, send 
>a request to mso-moderators@xxxxxxxxxxxxx and you will be sent an 
>invitation with instructions.  Once you are a member of the files group, 
>you can go here to upload/download files:
>http://www.smartgroups.com/vault/msofiles
>*************************************************************


*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) in 
the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts: