Question

If anyone know formula without code in SharePoint 2010 to show differens between dates without weekends and holidays, I'm trying to find solution but no result so far ...

I will be veru gratefull for support,

Was it helpful?

Solution

If you plan to do a calculated column, than indeed there is no out-of-the-box function that would it for you. The closest you could get is using the WEEKDAY to detect which day of a week it represents, and remove those (maybe build multiple calculated columns as support). I did found something close to what you are looking for (EXCEPT HOLIDAYS), maybe it helps:

=DATEDIF([Start Date],[Due Date],"D")-IF(WEEKDAY([Due Date])=7,FLOOR((DATEDIF([Start Date],[Due Date],"D")+WEEKDAY([Start Date]))/7,1)*2,FLOOR((DATEDIF([Start Date],[Due Date],"D")+WEEKDAY([Start Date]))/7,1)*2+1)+IF(WEEKDAY([Start Date])=7,2,1)

With SharePoint designer, if you plan to use this in a customization of a web part, with XSLT you could achieve the same, again, darn complicated - still nothing for Holidays as these are too specific - http://www.sharepointbloggers.com/2009/03/data-view-customization-calculating.html

In InfoPath though is much easier - few pointers http://alecpojidaev.wordpress.com/2008/12/30/infopath-codeless-programming-walkthrough-2/

OTHER TIPS

There's definitely no OOTB function that can do this. Just consider the different holidays around the world. How could you write a universal formula that takes into account all the different countries and calendar variations? So, I'm afraid you have to resort to some custom code functionality to do the calculation.

I achieved this by using a calculated column and a workflow. Users choose a start date and end date. A calculated column calculates the interval and removes any weekend days from the result with this formula:

(=IF(AND((WEEKDAY(EndDate,2))<(WEEKDAY(StartDate,2)),((WEEKDAY(StartDate,2))-(WEEKDAY(EndDate,2)))>1),(((DATEDIF(StartDate,EndDate,"D")+1))-(FLOOR((DATEDIF(StartDate,EndDate,"D")+1)/7,1)*2)-2),(((DATEDIF(StartDate,EndDate,"D")+1))-(FLOOR((DATEDIF(StartDate,EndDate,"D")+1)/7,1)*2))))

I then created a list of all holidays, numbering them 1-10

Create a workflow with variables: check date=StartDate and requested days=calculated column.

This will check your start date against your holiday list and subtract a day if there is a match, then it will increment to start date +1 and check again; this repeats until the end date has been checked.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top