<?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>Fri, 03 Feb 2012 16:49:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Free HTML Calculated Column for SharePoint</title>
		<link>http://blog.pentalogic.net/2012/01/free-html-calculated-column-for-sharepoint/</link>
		<comments>http://blog.pentalogic.net/2012/01/free-html-calculated-column-for-sharepoint/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 16:03:44 +0000</pubDate>
		<dc:creator>Stuart Pegg</dc:creator>
				<category><![CDATA[Calculated Columns]]></category>
		<category><![CDATA[Highlighter]]></category>
		<category><![CDATA[SharePoint HTML Calculated Column]]></category>
		<category><![CDATA[10 Percent Time]]></category>
		<category><![CDATA[HTML Calculated Column]]></category>
		<category><![CDATA[SharePoint Highlighter]]></category>

		<guid isPermaLink="false">http://blog.pentalogic.net/?p=2623</guid>
		<description><![CDATA[A free calculated column for SharePoint 2007 and 2010 that actually displays HTML.]]></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%2F2012%2F01%2Ffree-html-calculated-column-for-sharepoint%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.pentalogic.net%2F2012%2F01%2Ffree-html-calculated-column-for-sharepoint%2F&amp;source=pentalogic&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://blog.pentalogic.net/wp-content/uploads/2012/01/logo-wordy.jpg"><img style="background-image: none; border-right-width: 0px; margin: 0px auto 5px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="logo-wordy" border="0" alt="logo-wordy" src="http://blog.pentalogic.net/wp-content/uploads/2012/01/logo-wordy_thumb.jpg" width="436" height="149" /></a></p>
<p>A free calculated column for SharePoint 2007 and 2010 that allows you to display HTML: <a href="http://www.pentalogic.net/sharepoint-products/free-stuff/html-calculated-column" target="_blank">SharePoint HTML Calculated Column</a></p>
<p><a href="http://blog.pentalogic.net/wp-content/uploads/2012/01/html-formula2.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px auto 5px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top: 0px; border-right: 0px; padding-top: 0px" title="html-formula2" border="0" alt="html-formula2" src="http://blog.pentalogic.net/wp-content/uploads/2012/01/html-formula2_thumb.png" width="500" height="184" /></a></p>
<h3>Why did you make this?</h3>
<p>I spent a long time working on <a href="http://www.pentalogic.net/sharepoint-products/highlighter">SharePoint Highlighter</a>, and then later <a href="http://blog.pentalogic.net/2011/08/how-not-to-develop-a-sharepointtoday-calculated-column/">unsuccessfully trying to make a [Today] Calculated Column</a>. During both these projects we kept coming back to this glaring hole in SharePoint: You can’t use HTML in a calculated column.</p>
<p>After unsuccessfully looking for open source projects (or even commercial alternatives) for some time, the only solution I could find was <a href="http://blog.pathtosharepoint.com/2009/11/19/html-calculated-column-minor-update-and-some-advice/" target="_blank">Christophe’s JavaScript workaround</a> using a normal calculated column and a Content Editor Web Part. A nice solution, but unfortunately not without its drawbacks.</p>
<p>So when it came to deciding what I wanted to do in my <a href="http://blogs.pressgazette.co.uk/fleetstreet/2008/01/08/how-the-bbcs-10-per-cent-time-works/" target="_blank">10% time</a>, the answer was clear.</p>
<p>Having listened to me rant, rave, swear, and finally give up and denounce all Custom Field Type development (at least once a week during Highlighter, and several times during the <a href="http://blog.pentalogic.net/2011/08/how-not-to-develop-a-sharepointtoday-calculated-column/" target="_blank">[Today] incident</a>), Ryan’s reaction to my choice of project was a typically understated “I’m… surprised?”.</p>
<p>So during the TeamTime project I spent my Friday afternoons creating the first of hopefully many pet projects from us at Pentalogic: <a href="http://www.pentalogic.net/sharepoint-products/free-stuff/html-calculated-column" target="_blank">SharePoint HTML Calculated Column</a></p>
<h3><a href="http://blog.pentalogic.net/wp-content/uploads/2012/01/htmlccss.png"><img style="background-image: none; border-right-width: 0px; margin: 0px 0px 5px 5px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="htmlccss" border="0" alt="htmlccss" src="http://blog.pentalogic.net/wp-content/uploads/2012/01/htmlccss_thumb.png" width="584" height="292" /></a></h3>
<h3>How is this different to Christophe’s solution?</h3>
<p>Using the SharePoint HTML Calculated Column avoids the need to add Content Editor Web Parts (containing JavaScript) to every page you want the HTML to be displayed on.</p>
<p>Adding the CEWPs can be a bit of a chore in some cases, and are vulnerable to being accidentally broken by end users editing the pages. They can also be lost on 2007 to 2010 upgrades.</p>
<p>However, HTMLCC requires that a System Administrator install it on the SharePoint server; which in many organisations is a real pain in the ears. Whereas Christophe’s solution can be implemented by most power users.</p>
<h3>Isn’t this the same as Highlighter?</h3>
<p><a href="http://www.pentalogic.net/sharepoint-products/highlighter" target="_blank">SharePoint Highlighter</a> offers quite a lot more than this solution on it’s own. I won’t go into enormous detail, but here’s a sample of what Highlighter offers over the HTML Calculated Column:</p>
<ul>
<li>Row highlighting </li>
<li>Countdowns </li>
<li>Conditional formatting </li>
<li>Built-in icon library </li>
</ul>
<p>Most notably, all of this is offered through a polished and intuitive interface.</p>
<h3>Finally</h3>
<p>So, you get to plug the hole in SharePoint that’s bothered so many people over so much time, and we get to plug <a href="http://www.pentalogic.net/sharepoint-products/highlighter">SharePoint Highlighter</a> whenever we mention it. Everybody’s happy. <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://blog.pentalogic.net/wp-content/uploads/2011/11/wlEmoticon-smile.png" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pentalogic.net/2012/01/free-html-calculated-column-for-sharepoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Date Range filtering with the new version of FilterPoint, PivotPoint and Planner.</title>
		<link>http://blog.pentalogic.net/2011/12/date-range-filtering-with-the-new-version-of-filterpoint-pivotpoint-and-planner/</link>
		<comments>http://blog.pentalogic.net/2011/12/date-range-filtering-with-the-new-version-of-filterpoint-pivotpoint-and-planner/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 08:18:21 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[Calculated Columns]]></category>
		<category><![CDATA[Filter]]></category>
		<category><![CDATA[FilterPoint Web Part]]></category>
		<category><![CDATA[PivotPoint Web Part]]></category>
		<category><![CDATA[SharePoint Planner]]></category>
		<category><![CDATA[SharePoint webparts]]></category>
		<category><![CDATA[PivotPoint]]></category>
		<category><![CDATA[Planner]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://blog.pentalogic.net/?p=2645</guid>
		<description><![CDATA[FilterPoint has had the ability to send Date Filters but a common request has been Date Ranges – like showing everything this month, last year or between two arbitrary dates. The good news is that we&#8217;ve added this in to FilterPoint as of version 1.2 The bad news is that this will only work with our other SharePoint products [...]]]></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%2F2011%2F12%2Fdate-range-filtering-with-the-new-version-of-filterpoint-pivotpoint-and-planner%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.pentalogic.net%2F2011%2F12%2Fdate-range-filtering-with-the-new-version-of-filterpoint-pivotpoint-and-planner%2F&amp;source=pentalogic&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>FilterPoint has had the ability to send <a href="http://www.pentalogic.net/sharepoint-products/filterpoint/fp-manual/fp-configuration/filter-style/date-picker">Date Filters</a> but a common request has been <strong>Date Ranges</strong> – like showing everything this month, last year or between two arbitrary dates.</p>
<p><img class="aligncenter" src="http://static.pentalogic.net/filterpoint/date-range.png" alt="FilterPoint - Date Range Filtering" width="357" height="186" /></p>
<p>The good news is that we&#8217;ve added this in to FilterPoint as of version 1.2</p>
<p>The bad news is that this will only work with our other SharePoint products – <a href="http://www.pentalogic.net/sharepoint-products/planner">Planner</a> and <a href="http://www.pentalogic.net/sharepoint-products/pivotpoint">PivotPoint</a> – it won’t work with SharePoints built in List View web part (LVWP).</p>
<h3>That’s disappointing!</h3>
<p>Yes it is &#8211; it’s just a limitation of SharePoints filtering I am afraid, but all is not lost!</p>
<p>This page shows how you can do things like <strong><a href="http://www.pentalogic.net/sharepoint-products/filterpoint/fp-manual/fp-configuration/date-range-filtering">Month filtering using calculated columns</a></strong> and this blog article shows how you can setup <a href="http://blog.pentalogic.net/2009/11/howto-filter-items-current-calendar-month-view-sharepoint/">“Current Month/Previous Month” views using nothing more than Calculated Columns and View filters.</a></p>
<h3>Upgrading</h3>
<p>As always you can upgrade without losing any settings by downloading and running the latest trial version and selecting “Upgrade” when prompted (don’t forget you need the a recent version of <a href="http://www.pentalogic.net/sharepoint-products/planner">Planner</a> (v2.6.9+) and <a href="http://www.pentalogic.net/sharepoint-products/pivotpoint">PivotPoint</a> (2.2.0+) to accept date range filters.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pentalogic.net/2011/12/date-range-filtering-with-the-new-version-of-filterpoint-pivotpoint-and-planner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How not to develop a SharePoint [Today] Calculated column</title>
		<link>http://blog.pentalogic.net/2011/08/how-not-to-develop-a-sharepointtoday-calculated-column/</link>
		<comments>http://blog.pentalogic.net/2011/08/how-not-to-develop-a-sharepointtoday-calculated-column/#comments</comments>
		<pubDate>Mon, 22 Aug 2011 10:28:56 +0000</pubDate>
		<dc:creator>Stuart Pegg</dc:creator>
				<category><![CDATA[Calculated Columns]]></category>
		<category><![CDATA[Highlighter]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[SharePoint Development]]></category>
		<category><![CDATA[Today]]></category>

		<guid isPermaLink="false">http://blog.pentalogic.net/?p=2416</guid>
		<description><![CDATA[4 ways you can't develop a SharePoint [Today] friendly calculated column; from the abrupt to the dangerous.]]></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%2F2011%2F08%2Fhow-not-to-develop-a-sharepointtoday-calculated-column%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.pentalogic.net%2F2011%2F08%2Fhow-not-to-develop-a-sharepointtoday-calculated-column%2F&amp;source=pentalogic&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://blog.pentalogic.net/wp-content/uploads/2011/08/path-less-travelled-2.jpg"><img class="alignleft size-full wp-image-2422" title="path less travelled 2" src="http://blog.pentalogic.net/wp-content/uploads/2011/08/path-less-travelled-2.jpg" alt="" width="238" height="286" /></a>After developing <a href="http://www.pentalogic.net/sharepoint-products/highlighter" target="_blank">SharePoint Highlighter</a>, we seriously considered expanding on this area with a Calculated Column that would allow you to use [Today] in the formula. If you’re thinking “But you can already!” I suggest looking at Ryan’s article about the <a href="http://blog.pentalogic.net/2008/11/truth-about-using-today-in-calculated-columns/" target="_blank">[Today] column trick</a>.</p>
<p>Needless to say, this would be a very useful tool for almost any SharePoint user. After much researching and prototyping we came to an unfortunate conclusion: Although it was <em>possible</em> to make a Custom Field Type to do this, it was almost certainly impractical (certainly for us).</p>
<p>The avenues we investigated finished in three types of dead-end:</p>
<ul>
<li>Brick wall: A completely impassable system limitation.</li>
<li>Overgrown with brambles: Nothing but pain for all involved.</li>
<li>Swamps: A long unpleasant slog, with an uncertain outcome.</li>
</ul>
<h3>The Brick Wall</h3>
<p>The first thought in any developer’s mind when making a variation on a class should be “Inherit it”. It allows you to take advantage of the existing class’ methods with minimal difficulty and yet offers (almost) total control over its behaviour.</p>
<p>Attempting to do so will reward you with the slightly misleading error:</p>
<blockquote><p>The type &#8216;Microsoft.SharePoint.SPFieldCalculated&#8217; has no constructors defined</p></blockquote>
<p>A brief search in the MSDN documentation for <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfieldcalculated.aspx" target="_blank">SPFieldCalculated</a> shows that the absence of public constructors is intentional:</p>
<blockquote><p>Windows SharePoint Services 3.0 does not support inheriting from this class.</p></blockquote>
<p>And so this avenue ended in a brick wall. More worryingly; disallowing the inheritance of a class is usually a sign that something so heinous is happening inside that Microsoft doesn’t want it reproduced.</p>
<h3>Brambles</h3>
<p>Intrigued by the promise of horrifying creatures dwelling within, I had a look inside the class to see what was happening (using my own powers of code intuition, and not any kind of questionable reverse engineering method).</p>
<p>It seems the actual calculations take place outside of the SPFieldCalculated class, using instead a call to SPRequest. This new lane of research quickly ended in spiky brambles, as using a direct call to SPRequest would make our product (and hence anything it’s installed on) unsupported by Microsoft.</p>
<p>Undeterred, I took inspiration from the billing system at my old work and looked at keeping the ‘black box of calculation mystery’ class running in the background, with the new class acting as a wrapper around it.</p>
<p>Creating a Custom Field Type that kept a hidden field for data storage in the background was an architecture we’d experimented with when creating Highlighter, so adding a relatively minor call to update the formula with the current date and time seemed quite easy.</p>
<p>The thorny ending in this case was the enormous potential server load; updating the formula every time the list was viewed (to keep it up to date) caused the entire list’s worth of calculations to be refreshed. Viewing just 20 items would make up to 5000 items recalculate their values for each of our columns on the view.</p>
<h3>Swamps</h3>
<p>The final and most desperate option was to do it ourselves: Completely rewrite all or a subset of the calculated column functions, and handle the associated function nesting.</p>
<blockquote><p>I’m DIM: Doin’ It M’self.</p></blockquote>
<p>Following this path would mean wading through the boggy and unpleasant process of <em>exactly</em> reproducing Microsoft’s function calls; avoiding the murky bottomless pools of performance issues. All the while hoping we wouldn’t run into any of the hungry and sharp-toothed show stoppers along the way.</p>
<p>As you may have guessed, we didn’t venture down this path.</p>
<h3>Why are you telling me all this?</h3>
<p>Because although these paths aren’t available to us as an ISV, it doesn’t mean they aren’t options to you (except the brick wall, of course).</p>
<p>Brambles: Using SPRequest is unsupported, but if this doesn’t deter you then this is still very much an option. Similarly, if you have an abundance of processing power (or really need a space heater in your server room) performing complete column recalculations on every view shouldn’t bother you.</p>
<p>Swamps: If you have <em>very</em> specific requirements you could get away with only recoding a few functions, which would greatly reduce the chances of you disappearing forever. Alternatively, if you have a large herd of idle developers you could set about recreating the whole set. However, I doubt this is a serious option for anyone except the head of the Microsoft Silverlight team.</p>
<table border="0">
<tbody>
<tr>
<td><img title="cheat sheet screen shot" src="http://blog.pentalogic.net/wp-content/uploads/2011/05/cheat-sheet-screen-shot.png" alt="" width="149" height="220" /></td>
<td><iframe frameborder="0" height="230" scrolling="auto" src="http://www.pentalogic.net/sharepoint-knowledge-base/calculated-column-cheat-sheet/" width="440"></iframe></td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://blog.pentalogic.net/2011/08/how-not-to-develop-a-sharepointtoday-calculated-column/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>SharePoint Calculated Column Cheat Sheet</title>
		<link>http://blog.pentalogic.net/2011/05/sharepoint-calculated-column-cheat-sheet/</link>
		<comments>http://blog.pentalogic.net/2011/05/sharepoint-calculated-column-cheat-sheet/#comments</comments>
		<pubDate>Thu, 19 May 2011 12:00:45 +0000</pubDate>
		<dc:creator>Clare</dc:creator>
				<category><![CDATA[Calculated Columns]]></category>
		<category><![CDATA[SharePoint Ideas]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.pentalogic.net/?p=2171</guid>
		<description><![CDATA[SharePoint Calculated Column Cheat Sheet, easy 3 page Reference for the functions, formulas and operators used most commonly in SharePoint Calculated Columns.]]></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%2F2011%2F05%2Fsharepoint-calculated-column-cheat-sheet%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.pentalogic.net%2F2011%2F05%2Fsharepoint-calculated-column-cheat-sheet%2F&amp;source=pentalogic&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://blog.pentalogic.net/wp-content/uploads/2011/05/cheat-sheet-screen-shot.png"></a>Calculated columns are a really useful feature of any SharePoint list.</p>
<p>Whether you want to automatically show the profit on a sale, or the financial year that a date falls in to, or tidy up sloppy user input by capitalising names.  There is a lot you can do it with a Calculated Column.</p>
<p>But remembering the formulas and functions needed is not always easy, especially before the first coffee of the morning.  I know there is a way to get rid of the decimal places on a number but is it TRUN, or TRUNC, or TRUNK &#8211; oh no, hang on, that last one is just to do with elephants!</p>
<p>So, over the years we&#8217;ve gathered together a quick reference of some of the most commonly used functions and formulas &#8211; stuck on a wall above the desk it saves a lot of time and head scratching.  We&#8217;ve found ourselves sending it to clients from time to time, and they seem to find it quite handy too.</p>
<p>So we decided to tidy it up &#8211; clean off the coffee stains and make a nice PDF of it &#8211; and make it available to download, free &#8211; yes that&#8217;s right, FREE!</p>
<table border="0">
<tbody>
<tr>
<td><img title="cheat sheet screen shot" src="http://blog.pentalogic.net/wp-content/uploads/2011/05/cheat-sheet-screen-shot.png" alt="" width="149" height="220" /></td>
<td>
<p><iframe frameborder="0" height="230" scrolling="auto" src="http://www.pentalogic.net/sharepoint-knowledge-base/calculated-column-cheat-sheet/" width="440"></iframe></p>
</td>
</tr>
</tbody>
</table>
<p>So why not download our free Calculated Column Cheat Sheet and save yourself some time and headaches?  This easy 3 page reference sheet gives you a selection of commonly used calculated column formulas, along with a pretty thorough reference of most of the functions and operators you are likely to need in your day to day work.</p>
<p>Download, print, stick it on the wall, and we hope you find it as handy as we do!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pentalogic.net/2011/05/sharepoint-calculated-column-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to use [Today] in a SharePoint list</title>
		<link>http://blog.pentalogic.net/2011/05/how-use-today-in-a-sharepoint-list/</link>
		<comments>http://blog.pentalogic.net/2011/05/how-use-today-in-a-sharepoint-list/#comments</comments>
		<pubDate>Thu, 12 May 2011 10:25:00 +0000</pubDate>
		<dc:creator>Stuart Pegg</dc:creator>
				<category><![CDATA[Calculated Columns]]></category>
		<category><![CDATA[Highlighter]]></category>
		<category><![CDATA[SharePoint Development]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint Designer]]></category>
		<category><![CDATA[SharePoint Highlighter]]></category>
		<category><![CDATA[Workflows]]></category>

		<guid isPermaLink="false">http://blog.pentalogic.net/?p=2179</guid>
		<description><![CDATA[Explains why [Today] doesn't work in SharePoint calculated columns, and gives alternatives.]]></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%2F2011%2F05%2Fhow-use-today-in-a-sharepoint-list%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.pentalogic.net%2F2011%2F05%2Fhow-use-today-in-a-sharepoint-list%2F&amp;source=pentalogic&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://blog.pentalogic.net/wp-content/uploads/2011/05/today1.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px 0px 5px 5px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="today" border="0" alt="today" src="http://blog.pentalogic.net/wp-content/uploads/2011/05/today_thumb1.png" width="314" height="124" /></a></p>
<p>Quite frequently we see <a href="http://sharepoint.stackexchange.com/questions/12341/in-a-task-list-how-can-i-display-a-message-when-within-x-days-of-due-date" target="_blank">questions</a> about using the current date to display messages on a list when a date or time is (or will soon be) overdue. Most of these queries are from frustrated users who are trying to use [Today] in a calculated column, but find it missing.</p>
<p>I’ll quickly outline why this option is missing from calculated columns, and hence why the <a href="http://blog.pentalogic.net/2008/11/truth-about-using-today-in-calculated-columns/" target="_blank">notorious [Today] trick</a> is quite so controversial. But most importantly, I’ll run you through ways to actually display the information you want.</p>
<h3 style="vertical-align: bottom">Why is [Today] missing from calculated columns?</h3>
<p style="vertical-align: bottom">When we look at a SharePoint list, the vast majority of us are instantly reminded of Excel (or <a href="http://blog.pentalogic.net/2011/02/sharepoint-and-access-power-to-the-people/" target="_blank">Grandfather Excel</a>, if you prefer). Because of this we quite reasonably expect it to act like Excel, and hence expect it to reconsider every formula and data item on the page each time we view it.</p>
<p style="vertical-align: bottom">Unfortunately because of the much larger amount of information SharePoint has to pass back and forth, it takes a different approach to updating the data items. It will only update calculated values when the related item is added or edited.</p>
<p style="vertical-align: bottom">Consider SharePoint as an overworked secretary; if you ask for a file to be updated they’ll find it in the filing cabinet, update the information, and correct anything else that’s awry on the paperwork while they’re there. If you ask for all the files for people named “Smith” to be put on your desk, unless you specifically say “And update the information on every single one while you’re at it”, it’s not likely they’ll do the extra work for no reason.</p>
<p style="vertical-align: bottom">Because of this change in records-keeping, Microsoft had to skip functionality that would make this lower-maintenance updating method obvious. Since having a [Today] option would cause unedited items to go out of date every day, they had to leave it out. The [Me] option was another casualty, as it would require checking the current user every time the data was displayed.</p>
<p style="vertical-align: bottom">So how do we get our files updated without further flustering our imaginary secretary? There are several options:</p>
<ul>
<li><em>JavaScript</em>: Use a Content Editor Web Part. Also known as “Do it yourself.”. </li>
<li><em>Designer</em>: Create a custom view in SharePoint Designer. “Ask the secretary really nicely”. </li>
<li><em>Code</em>: Make your own custom field type from scratch. “Get your own team to do it”. </li>
<li><em><a href="http://www.pentalogic.net/sharepoint-products/highlighter" target="_blank">SharePoint Highlighter</a></em>: Our own solution to the problem. “Hire an extra secretary”. </li>
</ul>
<h3 style="vertical-align: bottom">JavaScript <img style="background-image: none; border-right-width: 0px; margin: 0px 0px 5px 5px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="document_into8" border="0" alt="document_into8" src="http://blog.pentalogic.net/wp-content/uploads/2011/05/document_into81.png" width="16" height="16" /></h3>
<p>Of course there’s always a JavaScript solution, and <a href="http://www.endusersharepoint.com/2009/01/23/jquery-for-everyone-replacing-today/" target="_blank">this one in particular</a> from Paul Grenier uses jQuery to help with the process. This will mean adding the jQuery libraries to your site, and it’s also necessary to add a Content Editor Web Part to each page you want the feature to work on.</p>
<p>A little JavaScript knowledge will probably be necessary to make it fit your requirements, and as with any code tweaking, the more you know the better the result will be.</p>
<h3 style="vertical-align: bottom">Designer <img style="background-image: none; border-right-width: 0px; margin: 0px 0px 5px 5px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="designer30" border="0" alt="designer30" src="http://blog.pentalogic.net/wp-content/uploads/2011/05/designer302.png" width="16" height="16" /></h3>
<p>SharePoint Designer is a <a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=d88a1505-849b-4587-b854-a7054ee28d66" target="_blank">free</a> and powerful (and hence often banned) tool from Microsoft for modifying your SharePoint site. Using Designer it’s possible to alter a view so that it uses Today when rendering the data on the page. This done by modifying the view’s XSLT (the template the view uses to decide what data goes where).</p>
<p>If you’d like a dabble to test the water of such changes, MSDN has a <a href="http://msdn.microsoft.com/en-us/library/ff630941.aspx" target="_blank">nice tutorial</a> on how to get started.</p>
<p>However, if you already have some experience with Designer (or you’d like to just jump straight in), Greg Osimowicz has an article on using Today in XSLT to <a href="http://sharepointapplied.com/2009/04/23/useless-calculated-column-today-trick-xsl-today-to-the-rescue/" target="_blank">calculate holidays accrued to date</a> (scroll down to “Below are the steps I followed:”).</p>
<h3 style="vertical-align: bottom">Code <img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="studio6" border="0" alt="studio6" src="http://blog.pentalogic.net/wp-content/uploads/2011/05/studio61.png" width="16" height="16" /></h3>
<p>There are a number of possible different methods to solving this problem using a <a href="http://msdn.microsoft.com/en-us/library/bb861799.aspx" target="_blank">custom field type</a>. As always this comes with my standard disclaimer that developing a custom field type from scratch for a single purpose requires a disproportionate investment of time for the results.</p>
<p>In 2010 it’s possible to do the calculations in the custom field type class (with some light persuasion), however this is not possible with 2007 as it does not use the class to render its information on list views.</p>
<p>Unfortunately not even <a href="http://msdn.microsoft.com/en-us/library/aa544291.aspx" target="_blank">CAML</a> can save us in this instance, as the View Schema doesn’t provide the current date in a usable form. But if you’re using 2010 you may be able to create a workaround with <a href="http://msdn.microsoft.com/en-us/library/ff606773.aspx" target="_blank">XSLT</a> and Greg’s Designer XSLT solution in the section above.</p>
<p>The last option is to use the field type to get JavaScript onto the page instead of using a CEWP. This has the benefit that you don’t need to put the CEWP on each page, but as I mentioned in my previous article it can be very troublesome to do so: <a href="http://blog.pentalogic.net/2011/05/how-to-do-list-highlighting-in-sharepoint/" target="_blank">How to do list highlighting in SharePoint</a></p>
<h3 style="vertical-align: bottom">SharePoint Highlighter <img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="currency_dollar4" border="0" alt="currency_dollar4" src="http://blog.pentalogic.net/wp-content/uploads/2011/05/currency_dollar41.png" width="16" height="16" /></h3>
<p>Normally this is the section where I’d talk about the benefits of a commercial solution, and try to avoid mentioning <a href="http://www.pentalogic.net/sharepoint-products/highlighter" target="_blank">SharePoint Highlighter</a> too much (I might even link to our <a href="http://www.pentalogic.net/sharepoint-products/highlighter/product-comparison-3" target="_blank">product comparison</a> page). However, it’s very difficult to talk in general terms about commercial products on the market that have this functionality when yours is the only one that does.</p>
<p>So I’m not going to beat around the bush: If you want to buy a commercial solution to change your list view display based on today’s date, then <a href="http://www.pentalogic.net/sharepoint-products/highlighter" target="_blank">SharePoint Highlighter</a> is the only (and hence best) solution. It does much more than just this, but I’m not going to blow my trumpet too much.</p>
<p> If you want to see a real life problem and its solution using SharePoint Highlighter; have a look at this <a href="http://sharepoint.stackexchange.com/questions/10205/check-if-more-than-3-hours/11317#11317" target="_blank">SharePoint Overflow question</a>.      </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pentalogic.net/2011/05/how-use-today-in-a-sharepoint-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using [Today] in SharePoint calculated default values</title>
		<link>http://blog.pentalogic.net/2010/09/today-sharepoint-calculated-default-values/</link>
		<comments>http://blog.pentalogic.net/2010/09/today-sharepoint-calculated-default-values/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 12:01:35 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[Calculated Columns]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Tip]]></category>
		<category><![CDATA[Today]]></category>

		<guid isPermaLink="false">http://blog.pentalogic.net/?p=1467</guid>
		<description><![CDATA[You can't use Today in SharePoint calculated columns but you CAN use it in calculated default values - here I explain why that is and how you might use it.]]></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%2F09%2Ftoday-sharepoint-calculated-default-values%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.pentalogic.net%2F2010%2F09%2Ftoday-sharepoint-calculated-default-values%2F&amp;source=pentalogic&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Despite the infamous “fake today column trick” still appearing in new blog posts on a monthly basis you <a href="http://blog.pentalogic.net/2008/11/truth-about-using-today-in-calculated-columns/">can’t use Today in calculated columns in SharePoint</a>.</p>
<p><br class="spacer_" /></p>
<p>I’ve seen people <a href="http://suguk.org/forums/24970/ShowThread.aspx" target="_blank">assume</a> (not unreasonably) that the same rule must apply with calculated default values used in columns that are not calculated columns as well &#8211; but strangely,  you actually can use Today in calculated default values, so I am going to explain why it works and how you might use this.</p>
<h3>What is the difference between Calculated Column and Calculated Default value?</h3>
<p>A <a href="http://office.microsoft.com/en-us/windows-sharepoint-services-help/calculate-data-in-lists-or-libraries-HA010105480.aspx" target="_blank">calculated column</a>, erm&#8230; calculates values from other columns in your list.</p>
<p style="text-align: center;"><a href="http://blog.pentalogic.net/wp-content/uploads/2010/09/calculated-column.jpg"><img class="size-full wp-image-1468  aligncenter" title="Calculated Column" src="http://blog.pentalogic.net/wp-content/uploads/2010/09/calculated-column.jpg" alt="SharePoint - add Calculated Column field" width="508" height="284" /></a></p>
<p>For example if you have an orders list with a <strong>Quantity</strong> and <strong>Price</strong> column you can calculate a <strong>Grand Total of Price * Quantity</strong>.</p>
<p>With a calculated default value you use a calculation to set the default value for a column that is not a calculated column &#8211; this is the value that is entered automatically when a new list item is created and may be over-written by the user.</p>
<p style="text-align: center;"><a href="http://blog.pentalogic.net/wp-content/uploads/2010/09/calculated-default-value.jpg"><img class="size-full wp-image-1469  aligncenter" title="Calculated default value" src="http://blog.pentalogic.net/wp-content/uploads/2010/09/calculated-default-value.jpg" alt="SharePoint - setting a calculated default value" width="509" height="213" /></a></p>
<p><strong>So why may I want a calculation using Today as the default value?</strong></p>
<p>Suppose we have a list containing customer complaints and we have a target to resolve everything in 3 days. Sometimes though for complex queries or if there are public holidays we may give more time. In that case we can set the default value as</p>
<pre>= Today + 3</pre>
<p>But the user can override that if necessary (public holiday etc).</p>
<h3>So why can I use Today here but not in calculated columns?</h3>
<p>With a calculated column the calculation is only reworked every time a record is updated. When it&#8217;s just viewed then it picks up the saved result from the last edit. This makes perfect sense for most calculated values, but not for values using <strong>Today </strong>or <strong>Me</strong>.</p>
<p>So for example if we tried to calculate the days left until a due date we might want to use</p>
<pre>Days left = Due Date - Today</pre>
<p>If we added the complaint on Monday then it would show that we have 3 days left to do it (Thursday). If we just look at the record on the Wednesday it would still show 3 days (as this was the calculation saved on Monday) when in fact we only have 1 day left to keep the customer happy.</p>
<p>That&#8217;s why <a href="http://blog.pentalogic.net/2008/11/truth-about-using-today-in-calculated-columns/">SharePoint wont let you use Today in calculated columns</a>.</p>
<p>However with a default calculated value the result is only worked out once when the record is being created – it’s understood that what is saved in this field is not updated automatically so there is no problem with using Today.</p>
<p><em>For a bonus point</em> &#8211; you can’t reference other fields in calculations for default values (e.g. Start Date or Order Date) as before a record is being created the fields don’t yet contain values.</p>
<h3>What else could I do with this?</h3>
<p>The OP in this thread is using it to <a href="http://suguk.org/forums/24970/ShowThread.aspx" target="_blank">set default financial years</a>. Suppose that your company’s financial year starts in April then you could use this formula to default to <strong>2009/10</strong> or <strong>2010/11</strong> on or after April.</p>
<pre>=IF(MONTH(Today)&gt;=4,"2010/11","2009/11")</pre>
<p>or generating the year 20xx/xx notation automatically :-</p>
<pre>=IF(MONTH(Today)&gt;=4,YEAR(Today) &amp; "/" &amp; (YEAR(Today)+1),(Year(Today)-1) &amp; "/" &amp; YEAR(Today))</pre>
<p>It’s also worth noting that you can use a similar formula in calculated columns – suppose you have an <strong>Order Date</strong> field and the financial year depends upon when the order was placed then simply replace <strong>Today </strong>with <strong>Order Date</strong>.</p>
<p><em>NB &#8211; This has been tested with SharePoint 2007/2010.</em></p>
<table style="background-color: #64be40; border-color: #39c63b; border-width: 0px; width: 661px; height: 51px;" border="0">
<tbody>
<tr>
<td>
<p><span style="font-size: large;"><span style="color: #ffffff;"><em><strong>Free SharePoint Calculated Column Cheat Sheet</strong></em></span></span></p>
</td>
</tr>
<tr>
<td><span style="font-size: small;"><span style="color: #ffffff;"><em><strong>a handy 3 page reference for calculated column functions and formulas.</strong></em></span></span></td>
</tr>
</tbody>
</table>
<table border="0">
<tbody>
<tr>
<td><img title="cheat sheet screen shot" src="http://blog.pentalogic.net/wp-content/uploads/2011/05/cheat-sheet-screen-shot.png" alt="" width="205" height="292" /></td>
<td>
<p><iframe frameborder="0" height="230" scrolling="auto" src="http://www.pentalogic.net/sharepoint-knowledge-base/calculated-column-cheat-sheet/" width="440"></iframe></p>
</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://blog.pentalogic.net/2010/09/today-sharepoint-calculated-default-values/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<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.]]></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;source=pentalogic&amp;style=normal&amp;b=2" 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>
<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>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>
<table style="background-color: #64be40; border-color: #39c63b; border-width: 0px; width: 661px; height: 51px;" border="0">
<tbody>
<tr>
<td>
<p><span style="font-size: large;"><span style="color: #ffffff;"><em><strong>Free SharePoint Calculated Column Cheat Sheet</strong></em></span></span></p>
</td>
</tr>
<tr>
<td><span style="font-size: small;"><span style="color: #ffffff;"><em><strong>a handy 3 page reference for calculated column functions and formulas.</strong></em></span></span></td>
</tr>
</tbody>
</table>
<table border="0">
<tbody>
<tr>
<td><img title="cheat sheet screen shot" src="http://blog.pentalogic.net/wp-content/uploads/2011/05/cheat-sheet-screen-shot.png" alt="" width="205" height="292" /></td>
<td>
<p><iframe frameborder="0" height="230" scrolling="auto" src="http://www.pentalogic.net/sharepoint-knowledge-base/calculated-column-cheat-sheet/" width="440"></iframe></p>
</td>
</tr>
</tbody>
</table>
]]></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>2</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 = [...]]]></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;source=pentalogic&amp;style=normal&amp;b=2" 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>
<table style="background-color: #64be40; border-color: #39c63b; border-width: 0px; width: 661px; height: 51px;" border="0">
<tbody>
<tr>
<td>
<p><span style="font-size: large;"><span style="color: #ffffff;"><em><strong>Free SharePoint Calculated Column Cheat Sheet</strong></em></span></span></p>
</td>
</tr>
<tr>
<td><span style="font-size: small;"><span style="color: #ffffff;"><em><strong>a handy 3 page reference for calculated column functions and formulas.</strong></em></span></span></td>
</tr>
</tbody>
</table>
<table border="0">
<tbody>
<tr>
<td><img title="cheat sheet screen shot" src="http://blog.pentalogic.net/wp-content/uploads/2011/05/cheat-sheet-screen-shot.png" alt="" width="205" height="292" /></td>
<td>
<p><iframe frameborder="0" height="230" scrolling="auto" src="http://www.pentalogic.net/sharepoint-knowledge-base/calculated-column-cheat-sheet/" width="440"></iframe></p>
</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://blog.pentalogic.net/2010/05/calculated-columns-adding-hours-onto-a-date-field/feed/</wfw:commentRss>
		<slash:comments>5</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 [...]]]></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;source=pentalogic&amp;style=normal&amp;b=2" 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>
<table style="background-color: #64be40; border-color: #39c63b; border-width: 0px; width: 661px; height: 51px;" border="0">
<tbody>
<tr>
<td>
<p><span style="font-size: large;"><span style="color: #ffffff;"><em><strong>Free SharePoint Calculated Column Cheat Sheet</strong></em></span></span></p>
</td>
</tr>
<tr>
<td><span style="font-size: small;"><span style="color: #ffffff;"><em><strong>a handy 3 page reference for calculated column functions and formulas.</strong></em></span></span></td>
</tr>
</tbody>
</table>
<table border="0">
<tbody>
<tr>
<td><img title="cheat sheet screen shot" src="http://blog.pentalogic.net/wp-content/uploads/2011/05/cheat-sheet-screen-shot.png" alt="" width="205" height="292" /></td>
<td>
<p><iframe frameborder="0" height="230" scrolling="auto" src="http://www.pentalogic.net/sharepoint-knowledge-base/calculated-column-cheat-sheet/" width="440"></iframe></p>
</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://blog.pentalogic.net/2009/11/howto-filter-items-current-calendar-month-view-sharepoint/feed/</wfw:commentRss>
		<slash:comments>106</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]]></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;source=pentalogic&amp;style=normal&amp;b=2" 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><iframe frameborder="0" height="230" scrolling="auto" src="http://www.pentalogic.net/sharepoint-knowledge-base/download-sharepoint-planner" width="750"></iframe></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>
	</channel>
</rss>

