• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Datedif funcation error on Negative Values

skorpion

New Member
im trying to get the value that how many year month and days remaining and i used datediff but problem is when end date is greater then start date its giving me error

here is the formula

=DATEDIF(DATEDIF(today(),U2,"ym") &" months," &DATEDIF(today(),U2,"md") &" days"

so when its negative i need same output

and noe know how can i get rid this error
 
no most of dates are negative as well and thn i got #NUM! error tis is the what i output i want is -1 month and -1 day

Function DATEDIF parameter 1 (2020/09/20) should be on or before Function DATEDIF parameter 2 (2020/08/19)
 
I sort it out myself

=datedif(if(today() < T14, today(),T14),IF(today()>T14,today(),T14),"ym") & if(datedif(if(today() > T14, today(),T14),IF(today()>T14,today(),T14),"ym")=1,"Dayes"," شهر- ")&datedif(if(today() < T14, today(),T14),IF(today()>T14,today(),T14),"md") & if(datedif(if(today() > T14, today(),T14),IF(today()>T14,today(),T14),"md")=1,"Dayes"," يوم ")



BUT when dates are negative uts must so me neagtive values
 
Last edited:
skorpion
Is this almost same Your previous thread? ... even duplicate?
 
BUT when dates are negative uts must so me neagtive values
Code:
=IF(TODAY()>T14,"-","") & DATEDIF(MIN(TODAY(), T14), MAX(TODAY(), T14),"ym") &
IF(DATEDIF(MIN(TODAY(), T14),MAX(TODAY(), T14),"ym")=1,"Dayes"," شهر- ")&
DATEDIF(MIN(TODAY(), T14),MAX(TODAY(), T14),"md") &
IF(DATEDIF(MIN(TODAY(), T14),MAX(TODAY(), T14),"md")=1,"Dayes"," يوم ")
 
Back
Top