Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sharepoint Date Time Calculated Column

I have 2 columns sDate ( Start Date ), eDate ( End Date ) in my list. The functionality I need

if(eDate == "" )
 print sDate // Nov 10
else if(MONTH(sDate) == MONTH(eDate))
 print sDate("mmm dd") + eDate(" - dd")  // Nov 10 - 17
else
 print sDate("mmm dd") + eDate(" - mmm dd") // Nov 10 - Dec 10

Orignal:

=IF(eDate="",TEXT(sDate,"mmm dd"),CONCATENATE(TEXT(sDate,"mmm dd")," ",(TEXT(eDate,"- dd"))))

I tried:

=IF(eDate="",TEXT(sDate,"mmm dd"),(IF(MONTH(sDate)=MONTH(eDate),CONCATENATE (TEXT(sDate,"mmm dd"), " ", TEXT(eDate,"- dd")),CONCATENATE (TEXT(sDate,"mmm dd"), " ", TEXT(eDate,"- mmm dd"))))

I get this exception, which is not very helpful:

The formula contains a syntax error or is not supported.
at Microsoft.SharePoint.Library.SPRequestInternalClass.UpdateField(String bstrUrl, String bstrListName, String bstrXML)
at Microsoft.SharePoint.Library.SPRequest.UpdateField(String bstrUrl, String bstrListName, String bstrXML)

like image 709
Vabs Avatar asked Sep 09 '26 23:09

Vabs


1 Answers

Add one more closing parenthesis ) at the end of the expression.

Excel is useful to debug SharePoint calculated column expressions - I have pasted your expression into Excel spreadsheet, replaced sDate and eDate with addresses of cells containing example dates and Excel suggested a correction automatically.

like image 119
Marek Grzenkowicz Avatar answered Sep 14 '26 16:09

Marek Grzenkowicz