DATEDIF function

steve21nj

Registered User.
Local time
Today, 11:58
Joined
Sep 11, 2012
Messages
260
Good afternoon,

I am building a code via sharepoint that follows the lines of ms excel.

1st Code
Code:
=DATEDIF([EOD Date],Today,"y")&" years, 
"&DATEDIF([EOD Date],Today,"ym")&" months, 
"&DATEDIF([EOD Date],Today,"md")&" days"
-In my first calculation, if [EOD Date] is blank, it will return 113 years, 7 months, and 17 days.
-EOD Date is a set column and Today works similar to Today().
-If [EOD Date] has a date, it will calculate fine. For example if I put 8/20/2013, it will return 0 years, 0 months, and 10 days.
Question: If the EOD Date is blank, how can I return the words "No data" instead of that crazy year, month, day combo?


2nd Code
I am attempting the same as above but have two dates labeled:
[Start Date]
[End Date]

In my first code, I only had one date.
Question: How do I account for two dates, with the floating Today() if [End Date] does not exist, also returning "No data" if [Start Date] is null?
 
I don't know anything about sharepoint but if writing the code in VBA one would check for blank dates before the Datedif statements and take the appropriate action.

Brian
 

Users who are viewing this thread

Back
Top Bottom