Answered by:
Sharepoint Calculated Date column

Question
-
Hi,
I have 2 fields
1. Submitted Date (type : date Picker)
2. Board Date (type : calculated column)
how can i calculate Board Date = [Submitted date] - 31. For this is calculation i need to exclude weekends, i only have to consider Monday through Friday. Any idea how this can be done?
Thanks in Advance
Friday, February 14, 2014 1:44 PM
Answers
-
Hi
check on my site
http://www.romeodonca.ro
I wrote a post about this ( calculation of working days ) .
If still need help, let me know
Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.
- Proposed as answer by Steven Andrews Friday, February 14, 2014 2:39 PM
- Marked as answer by Dennis Guo Sunday, February 23, 2014 1:54 PM
Friday, February 14, 2014 2:27 PM -
Hi,
To exclude the weekends and do the subtractions, you can try to use the YEAR, MONTH, DAY and WEEKDAY function to handle the date in use and use IF function to perform the subtractions accordingly.
Another workaround is that we can create an Event Receiver for this, with SharePoint Object Model and other powerful APIs, we can update the Board Date column with the calculated value when there is a new item added to this list.
SharePoint Object Model - SPListItem class
Add, Update and Delete List Items Programmatically in Sharepoint
More information about SharePoint Object Model:
http://msdn.microsoft.com/en-us/library/ms473633.ASPX
Here is a step by step sample on creating a simple Item added event receiver for Custom List in SharePoint 2010:
http://msdn.microsoft.com/en-us/library/ff398052.aspx
More information on Event Receiver for your reference:
http://msdn.microsoft.com/en-us/library/gg749858(v=office.14).aspx
http://msdn.microsoft.com/en-us/library/ff408183(v=office.14).aspx
Two links about DateTime Structure
http://msdn.microsoft.com/en-us/library/system.datetime(v=vs.110).aspx
A demo about Programming DateTime using C#
http://www.c-sharpcorner.com/uploadfile/mahesh/working-with-datetime-using-C-Sharp/
Best regards
Patrick Liang
TechNet Community Support- Marked as answer by Dennis Guo Sunday, February 23, 2014 1:54 PM
Tuesday, February 18, 2014 11:57 AM
All replies
-
Is this for the "31" number? or are you plugging this number in somewhere else?
Excel has a NETWORKDAYS function? Calculated columns in SharePoint tend to work similarly to Excel, there may be an off chance that NETWORKDAYS function exists...
Friday, February 14, 2014 1:53 PM -
this is number 31, Subtracting the submitted date by 31 weekdaysFriday, February 14, 2014 2:03 PM
-
Hi
check on my site
http://www.romeodonca.ro
I wrote a post about this ( calculation of working days ) .
If still need help, let me know
Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.
- Proposed as answer by Steven Andrews Friday, February 14, 2014 2:39 PM
- Marked as answer by Dennis Guo Sunday, February 23, 2014 1:54 PM
Friday, February 14, 2014 2:27 PM -
Hi,
To exclude the weekends and do the subtractions, you can try to use the YEAR, MONTH, DAY and WEEKDAY function to handle the date in use and use IF function to perform the subtractions accordingly.
Another workaround is that we can create an Event Receiver for this, with SharePoint Object Model and other powerful APIs, we can update the Board Date column with the calculated value when there is a new item added to this list.
SharePoint Object Model - SPListItem class
Add, Update and Delete List Items Programmatically in Sharepoint
More information about SharePoint Object Model:
http://msdn.microsoft.com/en-us/library/ms473633.ASPX
Here is a step by step sample on creating a simple Item added event receiver for Custom List in SharePoint 2010:
http://msdn.microsoft.com/en-us/library/ff398052.aspx
More information on Event Receiver for your reference:
http://msdn.microsoft.com/en-us/library/gg749858(v=office.14).aspx
http://msdn.microsoft.com/en-us/library/ff408183(v=office.14).aspx
Two links about DateTime Structure
http://msdn.microsoft.com/en-us/library/system.datetime(v=vs.110).aspx
A demo about Programming DateTime using C#
http://www.c-sharpcorner.com/uploadfile/mahesh/working-with-datetime-using-C-Sharp/
Best regards
Patrick Liang
TechNet Community Support- Marked as answer by Dennis Guo Sunday, February 23, 2014 1:54 PM
Tuesday, February 18, 2014 11:57 AM -
Hi ,
Please check the below link with the same as your case.
http://blog.pentalogic.net/2008/11/working-days-weekdays-holidays-sharepoint-calculated-columns/
Also to work on the Caculated column you can download the Cheat Sheet which will help you more.
Download Link for Cheat sheet :
http://blog.pentalogic.net/2011/05/sharepoint-calculated-column-cheat-sheet/
R.Mani http://rmanimaran.wordpress.com
Wednesday, February 19, 2014 12:05 PM