I want to calculate the difference between two dates and display the answer in years, months, and days in the target cell, which I have done fine, BUT... I also want the target cell to remain blank if the second date hasn't been entered yet. Here's the set up...
Cell C2: Entered into inventory date, D2 is the date it was taken out of inventory and J2 is my target cell.
My "DATEDIF" formula that works is: =DATEDIF(C2,D2,"y") & " years, " & DATEDIF(C2,D2,"ym") & " months, " & DATEDIF(C2,D2,"md") & " days"&IF(ISBLANK(D2),"",)
When I add the "ISBLANK" function to it, like this: =IF(ISBLANK(D2),"",(D2-C2))&DATEDIF(C2,D2,"y") & " years, " & DATEDIF(C2,D2,"ym") & " months, " & DATEDIF(C2,D2,"md") & " days"&IF(ISBLANK(D2),"",)
It leaves the it blank like it's suppose to but the years calculate like it's not reading the / between the month and year in the dates so I end up with something like 480 years 1 month 2days.
Please help, this is driving me crazy, I've worked on it for hours! Thank you!
Bookmarks