Forum Discussion

realKarimSaleh's avatar
realKarimSaleh
Copper Contributor
Mar 25, 2023
Solved

SharePoint list code syntax check

Hi I would really appreciate some insight as I have been stuck with my Formula for a calculation column in my SharePoint List as I have been getting syntax error. 

 

Here is what I am hoping to achieve with the formula. 

Calculate and output the days between Start Date and End Dates while excluding weekends and Also to exclude (From a Different List that has Holiday dates) the dates between Holiday Start Date and Holiday End Date while excluding Weekends as well. 

 

Here is my Formula - 

 

=IF(AND(WEEKDAY([Start Date],2)<6, WEEKDAY([End Date],2)<6),INT(([End Date]+1)-([Start Date]+1))-INT((([End Date]+1)-([Start Date]+1))/7)*2-IF(OR(WEEKDAY([Start Date],2)=7,WEEKDAY([Start Date],2)=1),1,0)-IF(OR(WEEKDAY([End Date],2)=7,WEEKDAY([End Date],2)=1),1,0)-SUM(IF(([Start Date]>=VacationDates[Start Date])*([Start Date]<VacationDates[End Date]),1,0)*((WEEKDAY(VacationDates[Start Date],2)<6)*(WEEKDAY(VacationDates[End Date],2)<6))),0)

 

 

I would really prevaricate some help

 

  • realKarimSaleh Note below limitations related to SharePoint calculated columns:

     

    • You cannot reference a value in a row/item other than the current row/item.

    • You cannot reference a value in another list or library.

    • You cannot reference the ID of a row for a newly inserted row. The ID does not yet exist when the calculation is performed.

    • You cannot reference another column in a formula that creates a default value for a column.

    DocumentationIntroduction to SharePoint formulas and functions 


    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

    For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs

  • realKarimSaleh Note below limitations related to SharePoint calculated columns:

     

    • You cannot reference a value in a row/item other than the current row/item.

    • You cannot reference a value in another list or library.

    • You cannot reference the ID of a row for a newly inserted row. The ID does not yet exist when the calculation is performed.

    • You cannot reference another column in a formula that creates a default value for a column.

    DocumentationIntroduction to SharePoint formulas and functions 


    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

    For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs

  • realKarimSaleh 

     

    We can't use reference of entries from different in SharePoint Calculated column.

     


    Hope it will helpful to you and if so then Please mark my response as Best Response & Like to help others in this community

Resources