<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pentalogic Technology &#187; Calculated Columns</title>
	<atom:link href="http://blog.pentalogic.net/tag/calculated-columns/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.pentalogic.net</link>
	<description>Company blog and SharePoint Tricks and Tips</description>
	<lastBuildDate>Thu, 29 Jul 2010 13:37:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>How To setup a SharePoint view filter to compare 2 list fields</title>
		<link>http://blog.pentalogic.net/2010/06/how-to-setup-sharepoint-view-filter-to-compare-2-list-fields/</link>
		<comments>http://blog.pentalogic.net/2010/06/how-to-setup-sharepoint-view-filter-to-compare-2-list-fields/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 13:35:22 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[Filter]]></category>
		<category><![CDATA[SharePoint Ideas]]></category>
		<category><![CDATA[Calculated Columns]]></category>
		<category><![CDATA[filters]]></category>

		<guid isPermaLink="false">http://blog.pentalogic.net/?p=875</guid>
		<description><![CDATA[SharePoint workaround to create a list view based on a comparison between 2 list fields - e.g. actual cost is greater than budget cost.


Related posts:<ol><li><a href='http://blog.pentalogic.net/2008/10/advanced-sharepoint-view-and-filters/' rel='bookmark' title='Permanent Link: Advanced SharePoint View and Filter techniques'>Advanced SharePoint View and Filter techniques</a> <small>Advanced SharePoint view and filter techniques focusing on the task...</small></li>
<li><a href='http://blog.pentalogic.net/2009/11/howto-filter-items-current-calendar-month-view-sharepoint/' rel='bookmark' title='Permanent Link: How To Use Filters in SharePoint to show items in the current Calendar Month'>How To Use Filters in SharePoint to show items in the current Calendar Month</a> <small> Its very easy using the Filter feature of SharePoint...</small></li>
<li><a href='http://blog.pentalogic.net/2008/10/extend-and-customise-sharepoint-task-lists/' rel='bookmark' title='Permanent Link: Extend and customise SharePoint Task lists'>Extend and customise SharePoint Task lists</a> <small>One great feature of SharePoint is the ability to extend...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float:right; margin-top:-100px; clear:both;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.pentalogic.net%2F2010%2F06%2Fhow-to-setup-sharepoint-view-filter-to-compare-2-list-fields%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.pentalogic.net%2F2010%2F06%2Fhow-to-setup-sharepoint-view-filter-to-compare-2-list-fields%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>There are many instances where you might want to view a set of SharePoint list records which have been filtered on a comparison between values in 2 columns.  You might want to view a list of all sales reps who have failed to hit their targets: Actual SalesCredit Limit, or employees who have not used their full vacation entitlement: Vacation Entitlement&gt;Days taken.</p>
<p>A customer recently contacted me with just this type of question :-</p>
<p>They use a <strong>SharePoint list to keep track of orders waiting to be manufactured and delivered</strong> &#8211; so amongst other fields they have <strong>Scheduled Delivery Date (which they have promised to a customer) and the Estimated Delivery Date</strong> which is kept up to date with the latest estimate. Most of the time the two agree but sometimes for various reasons the delivery date slips.</p>
<p>They have been using <a href="http://www.pentalogic.net/sharepoint-products/reminder">Reminder to send out automated emails for upcoming orders</a> and ones that had just been missed but they <strong>wanted to setup a view that would show only orders where the Estimated delivery date was later than the date they had told the customer</strong>. Account managers could then use this list to keep customers up to date &#8211; &#8220;There is a delay on that order we have scheduled for you for next month, we estimate it will be ready on the 17th&#8221;</p>
<p>Sounded pretty simple to me and I confidently told them how they could do it<span id="more-875"></span> &#8211; just setup a new view with a filter to only show those records where Scheduled Delivery Date is greater than Estimated Delivery Date.</p>
<p>But of course you can&#8217;t do this because in <strong>SharePoint view filters you can only use one field per filter expression </strong>- the other operand has to be fixed (like the string &#8220;27th March 2010&#8243;) and you get this helpful error message :-</p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<div id="attachment_878" class="wp-caption aligncenter" style="width: 343px"><a href="http://blog.pentalogic.net/wp-content/uploads/2010/05/Filter-value-is-not-in-a-supported-date-format.png"><img class="size-full wp-image-878 " title="Filter value is not in a supported date format" src="http://blog.pentalogic.net/wp-content/uploads/2010/05/Filter-value-is-not-in-a-supported-date-format.png" alt="Filter value is not in a supported date format" width="333" height="261" /></a><p class="wp-caption-text">&quot;Filter value is not in a supported date format&quot; or &quot;Fitler Value is not a valid Number&quot;</p></div>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p>This will happen any time you are trying to <strong>setup a SharePoint view filter to compare one field to another.</strong></p>
<p>The workaround is to use a calculated column to compare the field &#8211; then filter on the comparison.</p>
<table border="0">
<tbody>
<tr>
<td>
<p>So in our example we setup a new Calculated column called &#8220;Days Late&#8221;</p>
<p>Set its type to be Numeric and the formula to be</p>
<pre>=IF(ISBLANK([Estimated Delivery Date]) ,</pre>
<pre>    "",</pre>
<pre>    <span style="background-color: #ffff00;">[Scheduled Delivery Date]-[Estimated Delivery Date])</span></pre>
<p>The key part of the formula is the [Scheduled Delivery Date]-[Estimated Delivery Date]. The IF and ISBLANK stop the calculation being performed for empty date values &#8211; otherwise SharePoint will assume 1st Jan 1900 and show values like 40,000 days early!</p>
<p><em>(If you copy this formula into your calcualted column and get <strong>&#8220;The formula contains a syntax error  or is not supported.&#8221;</strong> errors check that you haven&#8217;t got any extra spaces anywhere and that the field names are correct)</em></p>
<p>So the result of this formula will be the number of days its going to be late - if its on time then it will be a zero and if its going to be early its a positive number of days (aka negative days late!)</p>
</td>
<td><a href="http://blog.pentalogic.net/wp-content/uploads/2010/05/calculated-column.png"><img class="aligncenter size-full wp-image-879" title="Days late calculated column" src="http://blog.pentalogic.net/wp-content/uploads/2010/05/calculated-column.png" alt="Days late calculated column" width="224" height="280" /></a></td>
</tr>
<tr>
<td>
<p>The next step is to setup a <strong>new view for Delayed Orders<span style="font-weight: normal;"> and set the</span><span style="font-weight: normal;"> filter to only show items when the </span>Days Late<span style="font-weight: normal;"> column is greater than 0.</span></strong></p>
<p>You may also want to filter out those deliveries that have already happened &#8211; you can do this by adding Status is not equal to completed or &#8220;Actual Delivery date is &#8221; or whatever works with our data.</p>
</td>
<td><a href="http://blog.pentalogic.net/wp-content/uploads/2010/05/Filter-greater-than-zero.png"><img class="aligncenter size-full wp-image-880" title="Filter-greater-than-zero" src="http://blog.pentalogic.net/wp-content/uploads/2010/05/Filter-greater-than-zero.png" alt="Filter-greater-than-zero" width="243" height="126" /></a></td>
</tr>
</tbody>
</table>
<h3>Automated Emails each time a delivery date slips</h3>
<table border="0">
<tbody>
<tr>
<td valign="top">
<p>For a bonus point I told them how they could setup a <a href="http://www.pentalogic.net/sharepoint-products/reminder">Reminder Web Part that would watch this view and send out automated emails to the account manager (or even directly to the customer) when an orders delivery date slips</a> &#8211; you can even set it up so that if date slips again another email is sent.</p>
<h3><strong>Tips</strong></h3>
<ul>
<li>You can use this technique when you are comparing other type of fields in SharePoint such as Numeric or Currency or even text based fields &#8211; First use a calculated field for the comparison then filter on the result of the calculated field.</li>
</ul>
<ul>
<li>You can&#8217;t use this type of technique for showing the number of days between a date and [Today] &#8211; not even with the <a href="http://blog.pentalogic.net/2008/11/truth-about-using-today-in-calculated-columns/">infamous fake Today column trick because it doesn&#8217;t work</a>.</li>
</ul>
<ul>
<li>But you can use Today in the filter part so you can use <a href="http://blog.pentalogic.net/2008/11/the-truth-about-using-today-in-filters/">filters for view such as tasks that are due in the next 7 days or overdue by 7 days or more.</a></li>
</ul>
</td>
<td><a href="http://blog.pentalogic.net/wp-content/uploads/2010/05/sharepoint-reminder-webpart.png"><img class="aligncenter size-full wp-image-882" title="SharePoint Reminder Web Part" src="http://blog.pentalogic.net/wp-content/uploads/2010/05/sharepoint-reminder-webpart.png" alt="SharePoint Reminder Web Part" width="193" height="495" /></a></td>
</tr>
</tbody>
</table>


<p>Related posts:<ol><li><a href='http://blog.pentalogic.net/2008/10/advanced-sharepoint-view-and-filters/' rel='bookmark' title='Permanent Link: Advanced SharePoint View and Filter techniques'>Advanced SharePoint View and Filter techniques</a> <small>Advanced SharePoint view and filter techniques focusing on the task...</small></li>
<li><a href='http://blog.pentalogic.net/2009/11/howto-filter-items-current-calendar-month-view-sharepoint/' rel='bookmark' title='Permanent Link: How To Use Filters in SharePoint to show items in the current Calendar Month'>How To Use Filters in SharePoint to show items in the current Calendar Month</a> <small> Its very easy using the Filter feature of SharePoint...</small></li>
<li><a href='http://blog.pentalogic.net/2008/10/extend-and-customise-sharepoint-task-lists/' rel='bookmark' title='Permanent Link: Extend and customise SharePoint Task lists'>Extend and customise SharePoint Task lists</a> <small>One great feature of SharePoint is the ability to extend...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.pentalogic.net/2010/06/how-to-setup-sharepoint-view-filter-to-compare-2-list-fields/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePoint Calculated columns &#8211; Adding hours onto a date field</title>
		<link>http://blog.pentalogic.net/2010/05/calculated-columns-adding-hours-onto-a-date-field/</link>
		<comments>http://blog.pentalogic.net/2010/05/calculated-columns-adding-hours-onto-a-date-field/#comments</comments>
		<pubDate>Tue, 18 May 2010 09:53:35 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[SharePoint Ideas]]></category>
		<category><![CDATA[Calculated Columns]]></category>
		<category><![CDATA[Formula]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Tip]]></category>

		<guid isPermaLink="false">http://blog.pentalogic.net/?p=825</guid>
		<description><![CDATA[
			
				
			
		
A customer recently contacted me with an interesting question.
They were using a SharePoint task list to help schedule jobs for field engineers but rather than have a Start Date and End Date field they wanted to have a Start Date and Duration field and automatically work out the End Date.
So End Date = Start Date [...]


Related posts:<ol><li><a href='http://blog.pentalogic.net/2008/11/working-days-weekdays-holidays-sharepoint-calculated-columns/' rel='bookmark' title='Permanent Link: Working Days, Weekdays and Holidays in SharePoint Calculated Columns'>Working Days, Weekdays and Holidays in SharePoint Calculated Columns</a> <small>This post shows you how to work with weekdays and...</small></li>
<li><a href='http://blog.pentalogic.net/2008/11/truth-about-using-today-in-calculated-columns/' rel='bookmark' title='Permanent Link: The Truth about using [Today] in SharePoint Calculated Columns'>The Truth about using [Today] in SharePoint Calculated Columns</a> <small>This post offers workaround for using values like [Today] and...</small></li>
<li><a href='http://blog.pentalogic.net/2009/10/tip-multiple-columns-planner-gantt-chart/' rel='bookmark' title='Permanent Link: Tip &#8211; Showing multiple columns in SharePoint Planner Webpart'>Tip &#8211; Showing multiple columns in SharePoint Planner Webpart</a> <small>This post shows how to show data from more than...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float:right; margin-top:-100px; clear:both;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.pentalogic.net%2F2010%2F05%2Fcalculated-columns-adding-hours-onto-a-date-field%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.pentalogic.net%2F2010%2F05%2Fcalculated-columns-adding-hours-onto-a-date-field%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>A customer recently contacted me with an interesting question.</p>
<p>They were using a SharePoint task list to help schedule jobs for field engineers but rather than have a Start Date and End Date field they wanted to have a Start Date and Duration field and automatically work out the End Date.</p>
<p>So <strong>End Date = Start Date + Duration</strong></p>
<p>They were then planning to display this using Planner in the <a href="http://www.pentalogic.net/sharepoint-products/planner/planner-manual?p=configuration/config_plannerstyle.htm">By Category</a> view which is <a href="http://www.pentalogic.net/sharepoint-products/planner">idea for resource booking as it makes it easy to see when a resource is booked or free</a> (SharePoints built in gantt chart can&#8217;t do this swimlane style of view and doesn&#8217;t support using calculated columns).</p>
<p>Now this is easy to do if the Duration is specified in days &#8211; in fact you just use the equation above &#8211; <strong>but what if Duration is in hours or minutes?</strong></p>
<p>First port of call is this page from Microsoft showing <a rel="nofollow" href="http://office.microsoft.com/en-us/sharepointtechnology/HA011609471033.aspx" target="_blank">examples of common date time formula you can use in SharePoint calculated columns</a> hmmm, adding days OK&#8230; adding months Check&#8230; adding years OK too&#8230;.but nothing about hours. Back to the drawing board.</p>
<p><span id="more-825"></span></p>
<p>The key bit of knowledge is that <strong>SharePoint stores all date/time values internally as the number of days since Jan 1st, 1900. </strong>So the number 100.5 in a date/time field is 100 days and 12 hours from 1st Jan 1900 at 00:00</p>
<table border="0">
<tbody>
<tr>
<td>
<p>Armed with this we get the following formula (where Duration is in hours)</p>
<p><strong>=[Start Date]+([Duration]/24)</strong></p>
<p>So what&#8217;s happening here?</p>
<p><strong>([Duration]/24) </strong>turns the number of hours in Duration to fractions of a day (e.g. 1 hr is 0.0416 of a day)</p>
<p>Then we add that number to the Start Date and finally as our calculated column is defined as a date/time field SharePoint is turning the number (e.g. 40,296.50) back into a readable date/time value.</p>
<p>Job done!</p>
<p><strong>Tips</strong></p>
<ul>
<li>This will work with Durations greater than 24 or even 1/2 hours etc.</li>
<li>If you want to specify Duration in minutes then instead of /24 above you would use /1440 (the number of minutes in a day).</li>
<li>You can use this for anything that has a duration &#8211; tasks, service jobs, meetings, flights, equipment booking etc.</li>
</ul>
<p><strong>Further reading</strong></p>
<ul>
<li><a href="http://abstractspaces.wordpress.com/2009/05/02/common-date- time-formulas-for-sharepoint-calculated-fields/" target="_blank">Common Date Time formulas for SharePoint</a></li>
</ul>
</td>
<td><a href="http://blog.pentalogic.net/wp-content/uploads/2010/05/sharepoint-calculated-column-add-hours-date.png"><img class="alignright size-full wp-image-833" title="SharePoint calculated column - adding hours to a date" src="http://blog.pentalogic.net/wp-content/uploads/2010/05/sharepoint-calculated-column-add-hours-date.png" alt="" width="271" height="442" /></a></td>
</tr>
</tbody>
</table>


<p>Related posts:<ol><li><a href='http://blog.pentalogic.net/2008/11/working-days-weekdays-holidays-sharepoint-calculated-columns/' rel='bookmark' title='Permanent Link: Working Days, Weekdays and Holidays in SharePoint Calculated Columns'>Working Days, Weekdays and Holidays in SharePoint Calculated Columns</a> <small>This post shows you how to work with weekdays and...</small></li>
<li><a href='http://blog.pentalogic.net/2008/11/truth-about-using-today-in-calculated-columns/' rel='bookmark' title='Permanent Link: The Truth about using [Today] in SharePoint Calculated Columns'>The Truth about using [Today] in SharePoint Calculated Columns</a> <small>This post offers workaround for using values like [Today] and...</small></li>
<li><a href='http://blog.pentalogic.net/2009/10/tip-multiple-columns-planner-gantt-chart/' rel='bookmark' title='Permanent Link: Tip &#8211; Showing multiple columns in SharePoint Planner Webpart'>Tip &#8211; Showing multiple columns in SharePoint Planner Webpart</a> <small>This post shows how to show data from more than...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.pentalogic.net/2010/05/calculated-columns-adding-hours-onto-a-date-field/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How To Use Filters in SharePoint to show items in the current Calendar Month</title>
		<link>http://blog.pentalogic.net/2009/11/howto-filter-items-current-calendar-month-view-sharepoint/</link>
		<comments>http://blog.pentalogic.net/2009/11/howto-filter-items-current-calendar-month-view-sharepoint/#comments</comments>
		<pubDate>Thu, 26 Nov 2009 21:55:53 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[Calculated Columns]]></category>
		<category><![CDATA[Filter]]></category>
		<category><![CDATA[SharePoint Ideas]]></category>
		<category><![CDATA[Tip]]></category>
		<category><![CDATA[View]]></category>

		<guid isPermaLink="false">http://blog.pentalogic.net/?p=373</guid>
		<description><![CDATA[
			
				
			
		
Its very easy using the Filter feature of SharePoint views to show only items completed in the last 30 days or items due in the next X days; for example :-
Completed &#62;= [Today]-30
On the Advanced SharePoint View and Filter techniques post Ed asked how you could filter for the current calendar month rather than a [...]


Related posts:<ol><li><a href='http://blog.pentalogic.net/2008/11/the-truth-about-using-today-in-filters/' rel='bookmark' title='Permanent Link: The &#8230; ehem&#8230; Truth about using [Today] in SharePoint Filters'>The &#8230; ehem&#8230; Truth about using [Today] in SharePoint Filters</a> <small>This post looks at the different requirement for using [Today]...</small></li>
<li><a href='http://blog.pentalogic.net/2008/10/advanced-sharepoint-view-and-filters/' rel='bookmark' title='Permanent Link: Advanced SharePoint View and Filter techniques'>Advanced SharePoint View and Filter techniques</a> <small>Advanced SharePoint view and filter techniques focusing on the task...</small></li>
<li><a href='http://blog.pentalogic.net/2009/10/tip-multiple-columns-planner-gantt-chart/' rel='bookmark' title='Permanent Link: Tip &#8211; Showing multiple columns in SharePoint Planner Webpart'>Tip &#8211; Showing multiple columns in SharePoint Planner Webpart</a> <small>This post shows how to show data from more than...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float:right; margin-top:-100px; clear:both;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.pentalogic.net%2F2009%2F11%2Fhowto-filter-items-current-calendar-month-view-sharepoint%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.pentalogic.net%2F2009%2F11%2Fhowto-filter-items-current-calendar-month-view-sharepoint%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Its very easy using the <a href="http://blog.pentalogic.net/2008/11/the-truth-about-using-today-in-filters/">Filter feature of SharePoint views to show only items completed in the last 30 days</a> or items due in the next X days; for example :-</p>
<pre>Completed &gt;= [Today]-30</pre>
<p>On the <a href="http://blog.pentalogic.net/2008/10/advanced-sharepoint-view-and-filters/">Advanced SharePoint View and Filter techniques</a> post Ed asked how you could filter for the current calendar month rather than a rolling 30 day period (for example all tasks due this calendar month).</p>
<p>Like all great questions it seemed simple enough &#8211; something like only showing items where the Month and Year of the due date = the Month and Year of the current date.</p>
<p><span id="more-373"></span></p>
<p>Alas, we <a href="http://blog.pentalogic.net/2008/11/truth-about-using-today-in-calculated-columns/">can&#8217;t use [Today] in calculated columns</a> and we can&#8217;t use functions like Month([Due Date]) in the filter &#8211; so this approach will not work.</p>
<p>The solution is to turn this on its head &#8211; its a bit weird, so bear with me!</p>
<p>We need to have two calculated fields, one showing the first day of the month that the due date is in and one showing the last day of the month that the due date is in.</p>
<p>We can then use the filter to show only records where</p>
<p>[Today] &gt;= First Day Of Month</p>
<p>AND</p>
<p>[Today] &lt;= Last Day Of Month</p>
<p>So looking at this in graphical form we have :-</p>
<div id="attachment_375" class="wp-caption aligncenter" style="width: 500px"><img class="size-full wp-image-375 " title="Timeline" src="http://blog.pentalogic.net/wp-content/uploads/2009/11/Timeline.png" alt="Timeline" width="490" height="82" /><p class="wp-caption-text">Timeline</p></div>
<ul>
</ul>
<ul>
<li>In this diagram the current date is 15th Nov (the orange dotted line).</li>
<li>Task 1 &amp; 2 should be shown if the current date [Today] is in between the first and the last day of November (the blue line)</li>
<li>Task 3 will not be shown until [Today] is between the first and the last day of December (the blue line)</li>
</ul>
<table border="0" cellpadding="3">
<tbody>
<tr>
<td><img class="aligncenter size-full wp-image-390" title="create-column" src="http://blog.pentalogic.net/wp-content/uploads/2009/11/create-column1.png" alt="create-column" width="209" height="359" /></td>
<td>
<p>To put this into SharePoint open your list, click Settings &gt; List settings &gt; Create Column and setup the following two columns.</p>
<p><br class="spacer_" /></p>
<ul>
<li>The first column will be called something like Start of Month</li>
<li>Set the column type to Calculated and the data type to Date only </li>
<li>Uncheck the &#8216;Add to default view&#8217; button as we want these columns to stay behind the scenes</li>
</ul>
<ul>
<li>The Start of Month column formula should be</li>
</ul>
<pre>    =DATE(YEAR([Due Date]), MONTH([Due Date]), 1)</pre>
<p><br class="spacer_" /></p>
<ul>
<li>The End of Month formula :-</li>
</ul>
<pre>    =DATE(YEAR([Due Date]), MONTH([Due Date])+1,1)-1

    <em>(Which is the first day of next month - 1)</em></pre>
</td>
</tr>
</tbody>
</table>
<p>View a few records to check the formula is working OK and you see the correct dates.</p>
<table border="0" cellpadding="3">
<tbody>
<tr>
<td><img class="aligncenter size-full wp-image-391" title="View-filter" src="http://blog.pentalogic.net/wp-content/uploads/2009/11/View-filter1.png" alt="View-filter" width="223" height="217" /></td>
<td>
<p>Now create a new view, call it something like &#8220;Due This Month&#8221; and setup the filter for</p>
<pre>Start of Month is less than or equal to [Today]
 AND
End of Month is greater than or equal to [Today]</pre>
</td>
</tr>
</tbody>
</table>
<h4><strong>Further tips</strong></h4>
<p>You can use this with date fields other than [Due Date] &#8211; e.g. [Created] for items created in the current month, [Modified] for items well&#8230; urm&#8230; modified in the current month!</p>
<p>Using the same technique you can also use the following formula</p>
<h4><strong>The current week (Sunday to Saturday inclusive)</strong></h4>
<pre> Start Week =[Due Date] - WEEKDAY([Due Date]) +1
 End Week   =[Due Date] +7 - WEEKDAY([Due Date])
</pre>
<h4><strong>The previous month</strong></h4>
<pre> Start Month =DATE(YEAR([Due Date]), MONTH([Due Date])+1, 1)
 End Month   =DATE(YEAR([Due Date]), MONTH([Due Date])+2,1)-1
</pre>
<h4>The next month</h4>
<pre>
<pre> Start Month =DATE(YEAR([Due Date]), MONTH([Due Date])-1, 1)
 End Month   =DATE(YEAR([Due Date]), MONTH([Due Date]),1)-1</pre>
</pre>
<h4><strong>The current year</strong></h4>
<pre> Start Year =DATE(YEAR([Due Date]),1,1)
 End Year   =DATE(YEAR([Due Date]),12,31)
<strong>
</strong></pre>
<h4><strong>Edit</strong></h4>
<p>I should make clear that this technique will not work correctly on Event lists with recurring event as SharePoint only records the start time of the first event, not each occurrence in the series.</p>
<h4><strong>References</strong></h4>
<ul>
<li><a rel="nofollow" href="http://office.microsoft.com/en-us/sharepointtechnology/CH101032601033.aspx" target="_blank">Date and time functions</a></li>
</ul>


<p>Related posts:<ol><li><a href='http://blog.pentalogic.net/2008/11/the-truth-about-using-today-in-filters/' rel='bookmark' title='Permanent Link: The &#8230; ehem&#8230; Truth about using [Today] in SharePoint Filters'>The &#8230; ehem&#8230; Truth about using [Today] in SharePoint Filters</a> <small>This post looks at the different requirement for using [Today]...</small></li>
<li><a href='http://blog.pentalogic.net/2008/10/advanced-sharepoint-view-and-filters/' rel='bookmark' title='Permanent Link: Advanced SharePoint View and Filter techniques'>Advanced SharePoint View and Filter techniques</a> <small>Advanced SharePoint view and filter techniques focusing on the task...</small></li>
<li><a href='http://blog.pentalogic.net/2009/10/tip-multiple-columns-planner-gantt-chart/' rel='bookmark' title='Permanent Link: Tip &#8211; Showing multiple columns in SharePoint Planner Webpart'>Tip &#8211; Showing multiple columns in SharePoint Planner Webpart</a> <small>This post shows how to show data from more than...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.pentalogic.net/2009/11/howto-filter-items-current-calendar-month-view-sharepoint/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>Tip &#8211; Showing multiple columns in SharePoint Planner Webpart</title>
		<link>http://blog.pentalogic.net/2009/10/tip-multiple-columns-planner-gantt-chart/</link>
		<comments>http://blog.pentalogic.net/2009/10/tip-multiple-columns-planner-gantt-chart/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 13:05:20 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[Calculated Columns]]></category>
		<category><![CDATA[SharePoint Planner]]></category>
		<category><![CDATA[SharePoint webparts]]></category>
		<category><![CDATA[Formula]]></category>
		<category><![CDATA[gantt]]></category>
		<category><![CDATA[Planner]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Tip]]></category>
		<category><![CDATA[WebPart]]></category>

		<guid isPermaLink="false">http://blog.pentalogic.net/?p=304</guid>
		<description><![CDATA[This post shows how to show data from more than one list column in one category or timeline in a SharePoint Planner webpart gantt view


Related posts:<ol><li><a href='http://blog.pentalogic.net/2008/10/adding-gridlines-to-the-planner-gantt-chart/' rel='bookmark' title='Permanent Link: Adding gridlines to the SharePoint Planner webpart Gantt chart'>Adding gridlines to the SharePoint Planner webpart Gantt chart</a> <small>This post shows how to use CSS to add gridlines...</small></li>
<li><a href='http://blog.pentalogic.net/2010/05/calculated-columns-adding-hours-onto-a-date-field/' rel='bookmark' title='Permanent Link: SharePoint Calculated columns &#8211; Adding hours onto a date field'>SharePoint Calculated columns &#8211; Adding hours onto a date field</a> <small> A customer recently contacted me with an interesting question....</small></li>
<li><a href='http://blog.pentalogic.net/2009/06/sharepoint-planner-new-version2-5-3/' rel='bookmark' title='Permanent Link: New version of SharePoint Planner Webpart (2.5.3)'>New version of SharePoint Planner Webpart (2.5.3)</a> <small>Version 2.5.3 of SharePoint Planner webpart is now available with...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float:right; margin-top:-100px; clear:both;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.pentalogic.net%2F2009%2F10%2Ftip-multiple-columns-planner-gantt-chart%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.pentalogic.net%2F2009%2F10%2Ftip-multiple-columns-planner-gantt-chart%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>There may be times when you want to display timeline or category information from more than one list column in a gantt chart. For example in the chart below we have taken information from the &#8220;priority&#8221; and &#8220;title&#8221; columns of a list to populate the category labels.</p>
<p>With Planner you can show multiple columns in the <a href="http://www.pentalogic.net/sharepoint-planner-v2/manual.aspx?Page=configuration%2fconfig_plannersource.htm">Category or on the Timeline of a Gantt chart</a> by using a calculated column to merge fields together.</p>
<p><img class="aligncenter size-full wp-image-305" title="concat-columns" src="http://blog.pentalogic.net/wp-content/uploads/2009/10/concat-columns.png" alt="concat-columns" width="600" height="87" /><br />
 For example to merge Priority and Title columns together you would :-</p>
<p><br class="spacer_" /></p>
<ul>
<li>From your list click Settings &gt; Create Column</li>
<li>Set a name such as &#8220;Category&#8221;</li>
<li>Choose Calculated for the type</li>
<li>In formula enter <em>(where [Title] etc is the name of the columns you want to merge)</em></li>
</ul>
<pre>      =[Priority] &amp; " : " &amp; [Title]</pre>
<ul>
<li>Uncheck &#8216;Add to default view&#8217; checkbox if you don&#8217;t want this appearing for the normal list view.</li>
<li>In Planner you can now select this column.</li>
</ul>
<p>You can merge multiple columns together, for example :-</p>
<pre>   =[Priority] &amp; " : " &amp; [Title] &amp; " - " &amp; [Assigned To]</pre>
<p>You can also use <a href="http://office.microsoft.com/en-us/sharepointtechnology/CH100650061033.aspx" target="_blank">SharePoint standard functions and formula</a> (many similar to excel) such as :-</p>
<pre>   =Text([Start Time],"mmm-yyyy") " : " &amp; [Title]</pre>
<p>Which would prefix the Title with Month and year, like so  <em>October-2009 : Your title here</em></p>
<p>To display the the duration in days you could use</p>
<pre>   =DATEDIF([Start Time],[End Time],"d") &amp; " Days"</pre>
<p><a href="http://office.microsoft.com/en-us/sharepointtechnology/HA101054791033.aspx?pid=CH100650061033#2" target="_blank">See some more examples of common functions</a></p>


<p>Related posts:<ol><li><a href='http://blog.pentalogic.net/2008/10/adding-gridlines-to-the-planner-gantt-chart/' rel='bookmark' title='Permanent Link: Adding gridlines to the SharePoint Planner webpart Gantt chart'>Adding gridlines to the SharePoint Planner webpart Gantt chart</a> <small>This post shows how to use CSS to add gridlines...</small></li>
<li><a href='http://blog.pentalogic.net/2010/05/calculated-columns-adding-hours-onto-a-date-field/' rel='bookmark' title='Permanent Link: SharePoint Calculated columns &#8211; Adding hours onto a date field'>SharePoint Calculated columns &#8211; Adding hours onto a date field</a> <small> A customer recently contacted me with an interesting question....</small></li>
<li><a href='http://blog.pentalogic.net/2009/06/sharepoint-planner-new-version2-5-3/' rel='bookmark' title='Permanent Link: New version of SharePoint Planner Webpart (2.5.3)'>New version of SharePoint Planner Webpart (2.5.3)</a> <small>Version 2.5.3 of SharePoint Planner webpart is now available with...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.pentalogic.net/2009/10/tip-multiple-columns-planner-gantt-chart/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SharePoint Reminder Webpart &#8211; Setting a variable Due In or Overdue By time</title>
		<link>http://blog.pentalogic.net/2009/06/setting-variable-due-in-or-overdue-by-time/</link>
		<comments>http://blog.pentalogic.net/2009/06/setting-variable-due-in-or-overdue-by-time/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 16:17:59 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[Calculated Columns]]></category>
		<category><![CDATA[SharePoint Reminder]]></category>
		<category><![CDATA[SharePoint webparts]]></category>
		<category><![CDATA[Reminder]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WebPart]]></category>

		<guid isPermaLink="false">http://blog.pentalogic.net/?p=131</guid>
		<description><![CDATA[This post gives 3 different methods for setting a variable "due in" or "overdue by" date in SharePoint Reminder webpart.


Related posts:<ol><li><a href='http://blog.pentalogic.net/2008/11/working-days-weekdays-holidays-sharepoint-calculated-columns/' rel='bookmark' title='Permanent Link: Working Days, Weekdays and Holidays in SharePoint Calculated Columns'>Working Days, Weekdays and Holidays in SharePoint Calculated Columns</a> <small>This post shows you how to work with weekdays and...</small></li>
<li><a href='http://blog.pentalogic.net/2009/09/pentalogic-reminder-sharepoint-alerts-recurring-events/' rel='bookmark' title='Permanent Link: Pentalogic SharePoint Reminder Webpart v1.6  &#8211; now supporting Sharepoint recurring events'>Pentalogic SharePoint Reminder Webpart v1.6  &#8211; now supporting Sharepoint recurring events</a> <small>v1.6 of Pentalogic Reminder Webpart for SharePoint is now the...</small></li>
<li><a href='http://blog.pentalogic.net/2010/06/sharepoint-reminder-webpart-version-1-7-8-now-available/' rel='bookmark' title='Permanent Link: SharePoint Reminder Webpart &#8211; version 1.7.8 now available'>SharePoint Reminder Webpart &#8211; version 1.7.8 now available</a> <small>New version 1.7.8 of SharePoint Reminder webpart is now available...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float:right; margin-top:-100px; clear:both;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.pentalogic.net%2F2009%2F06%2Fsetting-variable-due-in-or-overdue-by-time%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.pentalogic.net%2F2009%2F06%2Fsetting-variable-due-in-or-overdue-by-time%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>When you normally setup SharePoint Reminder webpart you can specify to send an email alert when  a date is <a href="http://www.pentalogic.net/sharepoint-reminder/manual.aspx?Page=webpart%2fconfig_sendwhen.htm" target="_blank"> Due In X days or Overdue by X days</a></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<div id="attachment_132" class="wp-caption aligncenter" style="width: 218px"><a style="align: center;" href="http://blog.pentalogic.net/wp-content/uploads/2009/06/duein.gif"><img class="size-full wp-image-132" title="When column Service Date is due in 5 days" src="http://blog.pentalogic.net/wp-content/uploads/2009/06/duein.gif" alt="" width="208" height="140" /></a><p class="wp-caption-text">When column Service Date is due in 5 days</p></div>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p>One fairly common requirement amongst users of Reminder is the ability to set  variable &#8216;Due In&#8217; or &#8216;Overdue By&#8217; times. For example lets imagine the scenario of a company using SharePoint and  Reminder to help control the servicing of various pieces of equipment.</p>
<p><span id="more-131"></span></p>
<p>Some equipment may be quite easy to service and replacements would be readily  available whilst they are &#8216;in the shop&#8217;. Other equipment could be very complex  and much more specialised meaning that we&#8217;ve got to arrange the servicing more  carefully to ensure its available when needed. For the standard type of  equipment perhaps we only need 5 days warning that its due for a service whilst  for the specialized equipment we need at least 30 days notice.</p>
<p>Another example a <a href="http://www.pentalogic.net/sharepoint-reminder/manual.aspx?Page=commonscenarios%2fhelpdesk%2fhelpdesk.htm" target="_blank"> helpdesk system</a> where you are sending out alerts when tickets are still open  after a certain time &#8211; in other words the Created date is overdue (or in the  past) by a certain number of hours or days. For high priority tickets or tickets  from certain people you may want to be alerted if they are still unresolved  after 1 day &#8211; others may be lest time critical and an alert after 2 days is fine.</p>
<p>So how do you do this? Well there are three ways, each with their own strengths :-</p>
<h3>Use an Alert Days column and a calculated column.</h3>
<p>Suppose we have a column Service Date we could add a number column called Alert Days  where we would enter the number of days notice we need for that record.</p>
<p>We then create a calculated column called Alert Date and with the formula</p>
<pre>[Service Date]-[Alert Days]</pre>
<p>Beware though, if you have any records with empty Service Date fields then  SharePoint will calculate this as &#8220;30th December <strong>1899</strong>&#8221; + [Alert  Days] leading to some very overdue records!</p>
<p>To protect against this you should use</p>
<p><span class="style2">=IF( ISBLANK([Service Date]), &#8220;&#8221; , [Service Date]]+[Alert  Days])</span></p>
<p>Which says If the Service Date is blank then the result is too,  otherwise the result is [Service Date]+[AlertDays]. (You could also use a view  to filter out any records with an empty Service Date)</p>
<p>We would end up with a list that looked something like this and we would then  setup a Reminder web part to watch for an overdue Alert Date.</p>
<table id="ft_k" class="zeroBorder" style="width: 100%;" border="0" cellspacing="1" cellpadding="3" bgcolor="#d9ead3" bordercolor="#0b5394">
<tbody>
<tr bgcolor="#6fa8dc">
<td>ID</td>
<td>Service Date</td>
<td>Alert Days</td>
<td>Alert Date</td>
</tr>
<tr>
<td width="5%">1</td>
<td>30th July</td>
<td>5</td>
<td>25th July</td>
</tr>
<tr>
<td width="5%">2</td>
<td>30th July</td>
<td>30</td>
<td>1st July</td>
</tr>
</tbody>
</table>
<p>So event though these two bits of equipment are due to be serviced by the  30th July we will only get an alert about #1 on the 25th (as its a simple bit of  equipment) but #2 is more complex we will get an alert 30 days before the  service is due to give time to organise everything.</p>
<p>This method has the advantage of flexibility, but it relies upon the person  entering data putting in a sensible value in Alert Days.</p>
<p><em>Tip &#8211; This page gives more examples of what you can do with </em> <a href="http://office.microsoft.com/en-us/sharepointtechnology/HA101054791033.aspx" target="_blank"> <em>calculated columns and formula</em></a><em> &#8211; for example adding a number of  months to a date.</em></p>
<h3>Use a calculated column that subtracts a different number of days based on a  status</h3>
<p>This is similar to the above method, but suppose we have a choice column called  Service Type that can either be Simple, Average or Complex. Again we want the  alerts for Simple equipment servicing to be 5 days in advance, Average to be 10 days and Complex to be 30.</p>
<p>This calculation will return the number of days to add :-</p>
<pre>=IF([Service Type]="Complex",30,IF([Service Type]="Average",15,5))</pre>
<p>Adding in ISBLANK as shown above gives</p>
<pre>=IF(ISBLANK([Service Date]),"",[Service Type] + IF([Service Type]="(Complex",30,IF([Service Type]="(2) Normal",15,5)))</pre>
<p>Or broken down for easy reading</p>
<table style="width: 100%;" border="0">
<tbody>
<tr>
<td style="padding-right: 20px;">
<pre>=IF(ISBLANK([Service Date]),"",</pre>
<pre>   [Service Date] +</pre>
<pre>      IF([Service Type]="Complex",30,</pre>
<pre>      IF([Service Type]="Average",15,</pre>
<pre>      5 )))</pre>
</td>
<td>
<pre><em>If the service date is blank then then the result is blank

else the result is [Service Date] +</em></pre>
<pre><em>   + 30 if Complex service
   or + 15 if Average service</em></pre>
<pre><em>   or +5 otherwise</em></pre>
</td>
</tr>
</tbody>
</table>
<p>So again we would create a calculated column called Alert Date, use the above  formula and setup a Reminder web part to send an email when the Alert Date is  Overdue (or Due Today).</p>
<p>The advantage of this method is that you are not relying on users entering  the correct figure in an Alert Days column and you can later change everything  by updating the formula, suppose you&#8217;ve now decided that you need 45 days notice  of complex services. The disadvantage is reduced flexibility.</p>
<h3>Using multiple Reminder Web Parts</h3>
<p>You can setup <a href="http://www.pentalogic.net/sharepoint-reminder/manual.aspx?Page=faq%2fcreateaview%2ffaq_createaview.htm" target="_blank"> Views</a> in SharePoint for various subsets of your list (think of 3 views  showing simple, average or complex equipment services). You could then setup 3  different reminder web parts set to <a href="http://www.pentalogic.net/sharepoint-reminder/manual.aspx?Page=webpart%2fconfig_list.htm" target="_blank"> watch the records in these views</a> and each web part could be set to send an  email alert a certain number of days in advance.</p>
<p>The advantage of this method is that any part of the configuration can be  different, for example you may wish to send the alerts about complex services to  different people or have a different subject line.</p>


<p>Related posts:<ol><li><a href='http://blog.pentalogic.net/2008/11/working-days-weekdays-holidays-sharepoint-calculated-columns/' rel='bookmark' title='Permanent Link: Working Days, Weekdays and Holidays in SharePoint Calculated Columns'>Working Days, Weekdays and Holidays in SharePoint Calculated Columns</a> <small>This post shows you how to work with weekdays and...</small></li>
<li><a href='http://blog.pentalogic.net/2009/09/pentalogic-reminder-sharepoint-alerts-recurring-events/' rel='bookmark' title='Permanent Link: Pentalogic SharePoint Reminder Webpart v1.6  &#8211; now supporting Sharepoint recurring events'>Pentalogic SharePoint Reminder Webpart v1.6  &#8211; now supporting Sharepoint recurring events</a> <small>v1.6 of Pentalogic Reminder Webpart for SharePoint is now the...</small></li>
<li><a href='http://blog.pentalogic.net/2010/06/sharepoint-reminder-webpart-version-1-7-8-now-available/' rel='bookmark' title='Permanent Link: SharePoint Reminder Webpart &#8211; version 1.7.8 now available'>SharePoint Reminder Webpart &#8211; version 1.7.8 now available</a> <small>New version 1.7.8 of SharePoint Reminder webpart is now available...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.pentalogic.net/2009/06/setting-variable-due-in-or-overdue-by-time/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Truth about using [Today] in SharePoint Calculated Columns</title>
		<link>http://blog.pentalogic.net/2008/11/truth-about-using-today-in-calculated-columns/</link>
		<comments>http://blog.pentalogic.net/2008/11/truth-about-using-today-in-calculated-columns/#comments</comments>
		<pubDate>Sat, 22 Nov 2008 13:36:34 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[Calculated Columns]]></category>
		<category><![CDATA[SharePoint Ideas]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Today]]></category>

		<guid isPermaLink="false">http://blog.pentalogic.net/?p=76</guid>
		<description><![CDATA[This post offers workaround for using values like [Today] and [Me] in SharePoint Calculated Columns


Related posts:<ol><li><a href='http://blog.pentalogic.net/2008/11/working-days-weekdays-holidays-sharepoint-calculated-columns/' rel='bookmark' title='Permanent Link: Working Days, Weekdays and Holidays in SharePoint Calculated Columns'>Working Days, Weekdays and Holidays in SharePoint Calculated Columns</a> <small>This post shows you how to work with weekdays and...</small></li>
<li><a href='http://blog.pentalogic.net/2010/05/calculated-columns-adding-hours-onto-a-date-field/' rel='bookmark' title='Permanent Link: SharePoint Calculated columns &#8211; Adding hours onto a date field'>SharePoint Calculated columns &#8211; Adding hours onto a date field</a> <small> A customer recently contacted me with an interesting question....</small></li>
<li><a href='http://blog.pentalogic.net/2008/11/the-truth-about-using-today-in-filters/' rel='bookmark' title='Permanent Link: The &#8230; ehem&#8230; Truth about using [Today] in SharePoint Filters'>The &#8230; ehem&#8230; Truth about using [Today] in SharePoint Filters</a> <small>This post looks at the different requirement for using [Today]...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float:right; margin-top:-100px; clear:both;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.pentalogic.net%2F2008%2F11%2Ftruth-about-using-today-in-calculated-columns%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.pentalogic.net%2F2008%2F11%2Ftruth-about-using-today-in-calculated-columns%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>If you try to create a calculated column with a formula containing [Today] or [Me] SharePoint gives the error :</p>
<pre><span style="color: #ff0000;">“Calculated columns cannot contain volatile functions like Today and Me”</span></pre>
<p>There are a few reasons you might want to do this. One would be to display how many days left you have to complete something, the other is to only show things added in the last X days or due in the next X days.</p>
<p>There are many pages mentioning this workaround :-</p>
<p>1) Create a dummy column called &#8220;Today&#8221;, then add your calculated column using [Today] in the formula, finally delete the dummy column. If you need to edit the formula then you have to go back to the start and add the dummy column again.</p>
<p>2) Optionally you can create a calculated column called &#8220;My Today&#8221; and set its formula to =[Today] using the trick above. Reference [My Today] in your other calculated columns. Thus you reference [My Today] which in turn references [Today]. Then you will not have to add the dummy column back in every time you want to edit formulae.</p>
<p>You then pat your self on the back and head home after another successful day of harassing SharePoint to do what you want, Hurrah!</p>
<p>But the next day you take a look at your list and its wrong. The formula has not updated and its still showing yesterdays value. DOH! SharePoint has made a fool of you after all.</p>
<p>Turns around there is actually a good reason for SharePoint not allowing volatile functions like [Today] or [Me] in calculated columns.</p>
<p><strong>&#8220;Calculated fields don&#8217;t update themselves until item itself is updated.&#8221;</strong></p>
<p>Read that again.</p>
<p>The value of a calculated column is only updated when item is edited and in the mean time you will see incorrect calculations every time you look. In fact, for most uses, this trick don&#8217;t give you anything more than just <a href="http://pathtosharepoint.wordpress.com/2008/08/14/calculated-columns-the-useless-today-trick/" target="_blank">referencing the [Modifed] column.</a></p>
<p>One workaround to the workaround problem is to <a href="http://www.sharepointblogs.com/dez/archive/2008/07/31/dynamically-updating-a-sharepoint-calculated-column-containing-a-quot-today-quot-reference.aspx" target="_blank">write a console app to find all these lists that use the [Today] trick and update them automatically once per day.</a> <em>But this workaround to the workaround problem may not be without its own problems that need to be worked around&#8230;.</em></p>
<p>Depending on your need there may be a simpler way &#8211; turn the problem on its head!</p>
<p><a href="http://blog.pentalogic.net/2008/10/advanced-sharepoint-view-and-filters/" target="_blank">In the example of using a calculated column to filter out items due in x days or overdue</a> SharePoint will accept [Today] as part of the <strong>Filter </strong>but will not as part of a calculated column &#8211; so give it what it wants</p>
<p><a href="http://blog.pentalogic.net/2008/11/the-ehem-truth-about-using-today-in-filters/">[EDIT- WSS 3 / MOSS 2007 now accepts this]</a></p>
<ul>
<li>Use a filter of [Created] is greater than [Today]-7</li>
</ul>
<p><em>(Note &#8211; its essential to have no spaces; [Today] &#8211; 7 will not work but [Today]-7 does.</em></p>
<p><strong>WSS 2 / SPS 2003</strong></p>
<ul>
<li>Create a column called <strong>&#8220;Filter 7 Days&#8221; and formula as =Created+7</strong></li>
<li>Then use a filter of <strong>&#8220;Filter 7 Days&#8221; is less than </strong><strong>[Today]</strong></li>
</ul>
<p>See this page for more details &#8211; <a href="http://blog.pentalogic.net/2008/10/advanced-sharepoint-view-and-filters/">http://blog.pentalogic.net/2008/10/advanced-sharepoint-view-and-filters/</a></p>
<ul>
<strong></strong>
</ul>
<p>So the calculated column is not dynamic (it will never need updating unless the record itself changes) and SharePoint is happy &#8211; but the filter <em>is dynamic</em> and you are happy!</p>
<p>If you want a countdown in your view (i.e. <a href="http://pathtosharepoint.wordpress.com/2008/08/25/a-countdown-for-tasks-lists/" target="_blank">Days left to complete a task</a>) then take a look at this post &#8211; <a href="http://pathtosharepoint.wordpress.com/2008/08/25/a-countdown-for-tasks-lists/" target="_blank">http://pathtosharepoint.wordpress.com/2008/08/25/a-countdown-for-tasks-lists/</a></p>
<p>Shameless plug &#8211; check this product out if you want <a href="http://www.pentalogic.net/sharepoint-reminder.aspx">&#8220;Alert Me&#8221; type emails when a task is due soon or overdue.</a></p>
<p><em>[EDIT] As it&#8217;s been pointed out to me the tone of this article was off from what I intended &#8211; the intention is to make clear that this well known and oft mentioned trick does not work as you might expect and to offer alternatives.</em></p>


<p>Related posts:<ol><li><a href='http://blog.pentalogic.net/2008/11/working-days-weekdays-holidays-sharepoint-calculated-columns/' rel='bookmark' title='Permanent Link: Working Days, Weekdays and Holidays in SharePoint Calculated Columns'>Working Days, Weekdays and Holidays in SharePoint Calculated Columns</a> <small>This post shows you how to work with weekdays and...</small></li>
<li><a href='http://blog.pentalogic.net/2010/05/calculated-columns-adding-hours-onto-a-date-field/' rel='bookmark' title='Permanent Link: SharePoint Calculated columns &#8211; Adding hours onto a date field'>SharePoint Calculated columns &#8211; Adding hours onto a date field</a> <small> A customer recently contacted me with an interesting question....</small></li>
<li><a href='http://blog.pentalogic.net/2008/11/the-truth-about-using-today-in-filters/' rel='bookmark' title='Permanent Link: The &#8230; ehem&#8230; Truth about using [Today] in SharePoint Filters'>The &#8230; ehem&#8230; Truth about using [Today] in SharePoint Filters</a> <small>This post looks at the different requirement for using [Today]...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.pentalogic.net/2008/11/truth-about-using-today-in-calculated-columns/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Working Days, Weekdays and Holidays in SharePoint Calculated Columns</title>
		<link>http://blog.pentalogic.net/2008/11/working-days-weekdays-holidays-sharepoint-calculated-columns/</link>
		<comments>http://blog.pentalogic.net/2008/11/working-days-weekdays-holidays-sharepoint-calculated-columns/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 15:14:25 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[Calculated Columns]]></category>
		<category><![CDATA[SharePoint Ideas]]></category>
		<category><![CDATA[SharePoint Reminder]]></category>
		<category><![CDATA[SharePoint webparts]]></category>
		<category><![CDATA[Reminder]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WebPart]]></category>

		<guid isPermaLink="false">http://blog.pentalogic.net/?p=71</guid>
		<description><![CDATA[This post shows you how to work with weekdays and weekends in SharePoint Calculated columns when calculating task due dates.


Related posts:<ol><li><a href='http://blog.pentalogic.net/2008/11/truth-about-using-today-in-calculated-columns/' rel='bookmark' title='Permanent Link: The Truth about using [Today] in SharePoint Calculated Columns'>The Truth about using [Today] in SharePoint Calculated Columns</a> <small>This post offers workaround for using values like [Today] and...</small></li>
<li><a href='http://blog.pentalogic.net/2010/05/calculated-columns-adding-hours-onto-a-date-field/' rel='bookmark' title='Permanent Link: SharePoint Calculated columns &#8211; Adding hours onto a date field'>SharePoint Calculated columns &#8211; Adding hours onto a date field</a> <small> A customer recently contacted me with an interesting question....</small></li>
<li><a href='http://blog.pentalogic.net/2009/10/tip-multiple-columns-planner-gantt-chart/' rel='bookmark' title='Permanent Link: Tip &#8211; Showing multiple columns in SharePoint Planner Webpart'>Tip &#8211; Showing multiple columns in SharePoint Planner Webpart</a> <small>This post shows how to show data from more than...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float:right; margin-top:-100px; clear:both;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.pentalogic.net%2F2008%2F11%2Fworking-days-weekdays-holidays-sharepoint-calculated-columns%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.pentalogic.net%2F2008%2F11%2Fworking-days-weekdays-holidays-sharepoint-calculated-columns%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>AcmeCorp aim to reply to customer complaints within 3 working days. They plan to use <a href="http://www.pentalogic.net/sharepoint-reminder.aspx" target="_blank">SharePoint Reminder webpart to alert managers when these targets are not being met</a>.</p>
<p>We have a list with the following information</p>
<div>
<table id="ft_k" class="zeroBorder" style="width: 100%;" border="0" cellspacing="1" cellpadding="3" bgcolor="#d9ead3" bordercolor="#0b5394">
<tbody>
<tr bgcolor="#6fa8dc">
<td>ID</td>
<td>Title</td>
<td>Date Received</td>
<td>Reply Due</td>
<td>Reply Sent</td>
</tr>
<tr>
<td width="5%">1</td>
<td>Order hasn&#8217;t arrived</td>
<td>Friday 7/Nov/08</td>
<td>Wed 12/Nov/08</td>
<td></td>
</tr>
<tr>
<td width="5%">2</td>
<td>Order missing items</td>
<td>Monday 10/Nov/08</td>
<td>Thursday 11/Nov/08</td>
<td></td>
</tr>
</tbody>
</table>
</div>
<p>Once we have this table we could make a <a href="http://blog.pentalogic.net/2008/10/extend-and-customise-sharepoint-task-lists/" target="_blank">View with a filter</a> to only show records that don&#8217;t yet have a Reply Sent date (i.e. they have not been dealt with) and then configure a Reminder web part to watch this view and <a href="http://www.pentalogic.net/sharepoint-reminder/manual.aspx?Page=commonscenarios%2ftasksdueandoverdue%2ftasks_dueandoverdue.htm" target="_blank">send out emails when the Reply Due date is overdue</a>.</p>
<p><span id="more-71"></span></p>
<p>If we didn&#8217;t care about working days we could set Reply Due to be a calculated column with a formula of</p>
<pre>=[Date Received]+3</pre>
<p>The question is &#8211; how do we work out the Reply Due date being 3 <strong>working </strong>days from the received date? (In AcmeCorps case a working week is Monday through Friday)</p>
<p>One of the <a href="http://msdn.microsoft.com/en-us/library/bb862071.aspx" target="_blank">calculated column functions</a> you can use in SharePoint is <strong>Weekday </strong>which returns 1 for Sunday, 2 for Monday and through to 7 for Saturday.</p>
<p>So from here we can work out if the day is</p>
<div>
<table id="uk.o" class="zeroBorder" style="width: 100%;" border="0" cellspacing="0" cellpadding="3" bgcolor="#d9ead3" bordercolor="#0b5394">
<tbody>
<tr bgcolor="#6fa8dc">
<td>Received</td>
<td>Weekday</td>
<td>Days to add</td>
<td>Reply Due</td>
</tr>
<tr>
<td>Sunday</td>
<td>1</td>
<td>+4</td>
<td>Thursday</td>
</tr>
<tr>
<td>Monday</td>
<td>2</td>
<td>+3</td>
<td>Thursday</td>
</tr>
<tr>
<td>Tuesday</td>
<td>3</td>
<td>+3</td>
<td>Friday</td>
</tr>
<tr>
<td>Wednesday</td>
<td>4</td>
<td>+5</td>
<td>Monday</td>
</tr>
<tr>
<td>Thursday</td>
<td>5</td>
<td>+5</td>
<td>Tuesday</td>
</tr>
<tr>
<td>Friday</td>
<td>6</td>
<td>+5</td>
<td>Wednesday</td>
</tr>
<tr>
<td>Saturday</td>
<td>7</td>
<td>+5</td>
<td>Thursday</td>
</tr>
</tbody>
</table>
</div>
<p>Or writing this another way</p>
<p>Weekday &gt; 3 then +5<br />
 Weekday = 2 or 3 then +3<br />
 Weekday = 1 then +4</p>
<p>or yet another way</p>
<pre>if weekday &gt; 3</pre>
<pre><span>   </span>add 5</pre>
<pre>else if weekday &gt; 1</pre>
<pre><span>   </span>add 3</pre>
<pre>else</pre>
<pre><span>   </span>add 4</pre>
<p>The final ninja move we need is the IF statement</p>
<pre>=IF(some expression, do this if true, do this if false)</pre>
<p>and these can be nested and combined with AND/OR or even nested with other IF&#8217;s &#8211; see the <a href="http://msdn.microsoft.com/en-us/library/bb862071.aspx" target="_blank">documentation.</a></p>
<p>We can put this into a formula for SharePoint calculated columns like this</p>
<pre><span style="color: #003366;"><strong>=IF(Weekday([Date Received])&gt;3, [Date Received]+5,
IF(Weekday([Date Received])&gt;1,[Date Received]+3,
[Date Received]+4))</strong></span></pre>
<p>Be very careful when entering this sort of formula, if you get the field names wrong or put a space or a bracket in the wrong place then you will see an error.</p>
<p>You can use the above method if your due date is 4,6,7,8,9 etc days on, just adjust the number of days you add as appropriate.</p>
<p>If your due dates are always a multiple of 5 (e.g. 5,10,15) working days then your job is easier as you will always have 2 weekend days involved so you can just add 7,14,21 etc using <strong>=[Field]+7</strong></p>
<p><em>(FREE BONUS! This also works in Excel, remember to change the Date Received to the column/row reference and don&#8217;t use square brackets [] and also format the column as a Date)</em></p>
<h3>But what about holidays?</h3>
<p>Ahhh, that&#8217;s the problem with this method and there is no easy solution without some complex custom workflow code.</p>
<p>One thing that may work for your circumstance is to add a Reply Due column, set it to Date Time type and set the default value to a Calculated Value with the following formula</p>
<pre>=IF(WEEKDAY(Today)&gt;3,Today+5,IF(WEEKDAY(Today)&gt;1,Today+3,Today+4))</pre>
<p>This will set the Due Date as 3 working days from when the record was entered but it could be overridden manually if there are holiday days between Today and the due date.</p>


<p>Related posts:<ol><li><a href='http://blog.pentalogic.net/2008/11/truth-about-using-today-in-calculated-columns/' rel='bookmark' title='Permanent Link: The Truth about using [Today] in SharePoint Calculated Columns'>The Truth about using [Today] in SharePoint Calculated Columns</a> <small>This post offers workaround for using values like [Today] and...</small></li>
<li><a href='http://blog.pentalogic.net/2010/05/calculated-columns-adding-hours-onto-a-date-field/' rel='bookmark' title='Permanent Link: SharePoint Calculated columns &#8211; Adding hours onto a date field'>SharePoint Calculated columns &#8211; Adding hours onto a date field</a> <small> A customer recently contacted me with an interesting question....</small></li>
<li><a href='http://blog.pentalogic.net/2009/10/tip-multiple-columns-planner-gantt-chart/' rel='bookmark' title='Permanent Link: Tip &#8211; Showing multiple columns in SharePoint Planner Webpart'>Tip &#8211; Showing multiple columns in SharePoint Planner Webpart</a> <small>This post shows how to show data from more than...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.pentalogic.net/2008/11/working-days-weekdays-holidays-sharepoint-calculated-columns/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>
