{"id":179,"date":"2009-10-06T15:28:40","date_gmt":"2009-10-06T15:28:40","guid":{"rendered":"http:\/\/www.myfatblog.co.uk\/?p=179"},"modified":"2009-10-06T15:28:40","modified_gmt":"2009-10-06T15:28:40","slug":"whats-the-record-for-the-longest-calculated-sharepoint-column","status":"publish","type":"post","link":"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/10\/whats-the-record-for-the-longest-calculated-sharepoint-column\/","title":{"rendered":"Whats the record for the longest Calculated SharePoint column?"},"content":{"rendered":"<p>Well my longest to date is 304 characters.. I&#8217;m not quite sure what the SharePoint limit is, but here&#8217;s mine&#8230;<\/p>\n<blockquote><p>=IF(LEN(MONTH(Dated)\/3)=1,TEXT(Dated,&#8221;mmm-yy&#8221;),IF(LEN((MONTH(DATE(YEAR(Dated),MONTH(Dated)+1,DAY(Dated))))\/3)=1,TEXT(DATE(YEAR(Dated),MONTH(Dated)+1,DAY(Dated)),&#8221;mmm-yy&#8221;),IF(LEN((MONTH(DATE(YEAR(Dated),MONTH(Dated)+2,DAY(Dated))))\/3)=1,TEXT(DATE(YEAR(Dated),MONTH(Dated)+2,DAY(Dated)),&#8221;mmm-yy&#8221;),&#8221;ERR&#8221;)))<\/p><\/blockquote>\n<p>&#8220;And what pray, does that monstrosity do&#8221;, I hear you ask&#8230;<\/p>\n<p>The answer is, it simply works out which quarter of the companies financial year the item appears in. The list item has a column called Dated which is a date only field.<\/p>\n<p>Our financial year runs 1st Oct to 30th Sept with each quarter ending Dec,Mar,Jun,Sep.<\/p>\n<p>In order to work out which quarter the item is in, I&#8217;ve nested 3 IF&#8217;s together.. If you&#8217;re not familiar with how the =IF function works in a calculated column, then it breaks down like this..<\/p>\n<p>=IF(jonnysapples > janesapples,&#8221;Jonny has more apples&#8221;,&#8221;Jane has more apples&#8221;)<br \/>\n=IF(SOMETHING TO TEST)        , DO THIS FOR TRUE      , DO THIS FOR FALSE)<\/p>\n<p>So in this instance if the column named Jonnysapples does indeed have more apples in it, then the phrase &#8220;Jonny has more apples&#8221; will be displayed in the resulting column. If it doesn&#8217;t, then &#8220;Jane has more apples&#8221; will be displayed.<\/p>\n<p>Excellent.. So now what we want to do, is replace the output statement for FALSE (&#8220;<strong>Jane has more apples<\/strong>&#8220;) with the next test to see if Jonny is unhappy.<\/p>\n<p>e.g.<\/p>\n<p>=IF(jonnysapples > janesapples,&#8221;Jonny has more apples&#8221;,IF(jonnysmoney>0,&#8221;Jonny doesn&#8217;t care as he can buy some more&#8221;,&#8221;Jonny is upset because Jane has more apples&#8221;))<\/p>\n<p>So, working the logic through,if Jonny has more Apples, we&#8217;ll see &#8220;<strong>Jonny has more apples<\/strong>&#8220;, if he has less, but some money (After checking the money column), then we&#8217;ll see &#8220;<strong>Jonny doesn&#8217;t care as he can buy some more<\/strong>&#8221; and then finally, if Jonny has less apples and no money, We&#8217;ll see the final state of &#8220;<strong>Jonny is upset because Jane has more apples<\/strong>&#8221;<\/p>\n<p>So now we&#8217;ve implemented a 3 state result. By nesting a further if statement we&#8217;re able to twist this solution to our means.<\/p>\n<p>So now we need to look at what logic we&#8217;re actually implementing in each of the IF statements.If you extract the &#8220;Something to test&#8221; part out of the first statement you&#8217;ll see:-<\/p>\n<p><strong>LEN(MONTH(Dated)\/3)=1<\/strong><\/p>\n<p>Now if you bear in mind that the months that represent our year quarter period ends are all a factor of 3, then it starts to make sense. (Sept &#8211; 9th Month, June, 6th Month etc) Take the numeric value for the month. if you divide it by 3 and get a whole number e.g. a result with a length of 1, then we&#8217;re in a month divisible by 3. if we get any form of decimal, then we&#8217;re not.<\/p>\n<p><strong>=IF(LEN(MONTH(Dated)\/3)=1,TEXT(Dated,&#8221;mmm-yy&#8221;),&#8221;DO THIS FOR FALSE&#8221;)<\/strong><\/p>\n<p>So if the month can be divided by 3 without any decimals, we&#8217;ll output the Dated column, formatted to look like mmm-yy. If it can&#8217;t then we&#8217;ll step into the next if statement in place of &#8220;DO THIS FOR FALSE&#8221;.<\/p>\n<p>Again, very similar logic, however this time, we&#8217;re going to add 1 month to the date in Created and test that..<\/p>\n<p><strong>IF(LEN((MONTH(DATE(YEAR(Dated),MONTH(Dated)+1,DAY(Dated))))\/3)=1,<\/strong><\/p>\n<p>If that results in a whole number, then we&#8217;ll output the Created+1 month using <strong>TEXT(DATE(YEAR(Dated),MONTH(Dated)+1,DAY(Dated)),&#8221;mmm-yy&#8221;),<\/strong><\/p>\n<p>And if it doesn&#8217;t? Yep you guessed it, we step into the third and final IF statement which we know is going to be true because the 4 month will divide by 3 once again. However to keep the parser happy, we&#8217;ve got to have an option of something to output for False, so that&#8217;s where you&#8217;ll see &#8220;ERR&#8221; in the formulae.<\/p>\n<p>If this has worked, all you&#8217;ll see in your calculated column is Sep-09,Dec-09,Mar-10,Jun-10 etc&#8230;.<\/p>\n<p>This solution might not work for your if you use a different financial year and quarters, but the principal is sound..<\/p>\n<p>Regards<\/p>\n<p>Paul.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Well my longest to date is 304 characters.. I&#8217;m not quite sure what the SharePoint limit is, but here&#8217;s mine&#8230; =IF(LEN(MONTH(Dated)\/3)=1,TEXT(Dated,&#8221;mmm-yy&#8221;),IF(LEN((MONTH(DATE(YEAR(Dated),MONTH(Dated)+1,DAY(Dated))))\/3)=1,TEXT(DATE(YEAR(Dated),MONTH(Dated)+1,DAY(Dated)),&#8221;mmm-yy&#8221;),IF(LEN((MONTH(DATE(YEAR(Dated),MONTH(Dated)+2,DAY(Dated))))\/3)=1,TEXT(DATE(YEAR(Dated),MONTH(Dated)+2,DAY(Dated)),&#8221;mmm-yy&#8221;),&#8221;ERR&#8221;))) &#8220;And what pray, does that monstrosity do&#8221;, I hear you ask&#8230; The answer is, it simply works out which quarter of the companies financial year the item appears in. The list item has a &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/10\/whats-the-record-for-the-longest-calculated-sharepoint-column\/\">Continue reading<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[34,3,16],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Whats the record for the longest Calculated SharePoint column? - Blog of an overweight SharePoint addict<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/10\/whats-the-record-for-the-longest-calculated-sharepoint-column\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Whats the record for the longest Calculated SharePoint column? - Blog of an overweight SharePoint addict\" \/>\n<meta property=\"og:description\" content=\"Well my longest to date is 304 characters.. I&#8217;m not quite sure what the SharePoint limit is, but here&#8217;s mine&#8230; =IF(LEN(MONTH(Dated)\/3)=1,TEXT(Dated,&#8221;mmm-yy&#8221;),IF(LEN((MONTH(DATE(YEAR(Dated),MONTH(Dated)+1,DAY(Dated))))\/3)=1,TEXT(DATE(YEAR(Dated),MONTH(Dated)+1,DAY(Dated)),&#8221;mmm-yy&#8221;),IF(LEN((MONTH(DATE(YEAR(Dated),MONTH(Dated)+2,DAY(Dated))))\/3)=1,TEXT(DATE(YEAR(Dated),MONTH(Dated)+2,DAY(Dated)),&#8221;mmm-yy&#8221;),&#8221;ERR&#8221;))) &#8220;And what pray, does that monstrosity do&#8221;, I hear you ask&#8230; The answer is, it simply works out which quarter of the companies financial year the item appears in. The list item has a &hellip; Continue reading\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/10\/whats-the-record-for-the-longest-calculated-sharepoint-column\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog of an overweight SharePoint addict\" \/>\n<meta property=\"article:published_time\" content=\"2009-10-06T15:28:40+00:00\" \/>\n<meta name=\"author\" content=\"Cimares\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@cimares\" \/>\n<meta name=\"twitter:site\" content=\"@cimares\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Cimares\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/10\/whats-the-record-for-the-longest-calculated-sharepoint-column\/\",\"url\":\"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/10\/whats-the-record-for-the-longest-calculated-sharepoint-column\/\",\"name\":\"Whats the record for the longest Calculated SharePoint column? - Blog of an overweight SharePoint addict\",\"isPartOf\":{\"@id\":\"http:\/\/www.myfatblog.co.uk\/#website\"},\"datePublished\":\"2009-10-06T15:28:40+00:00\",\"dateModified\":\"2009-10-06T15:28:40+00:00\",\"author\":{\"@id\":\"http:\/\/www.myfatblog.co.uk\/#\/schema\/person\/55ae8f6885bb5b8390dad001f3da83c6\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/10\/whats-the-record-for-the-longest-calculated-sharepoint-column\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.myfatblog.co.uk\/#website\",\"url\":\"http:\/\/www.myfatblog.co.uk\/\",\"name\":\"Blog of an overweight SharePoint addict\",\"description\":\"The rantings of a (not so) food obsessed IT consultant!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.myfatblog.co.uk\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"http:\/\/www.myfatblog.co.uk\/#\/schema\/person\/55ae8f6885bb5b8390dad001f3da83c6\",\"name\":\"Cimares\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/www.myfatblog.co.uk\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/www.myfatblog.co.uk\/images\/BlogImages\/About_D057\/TopOfTheWorld.jpg\",\"contentUrl\":\"http:\/\/www.myfatblog.co.uk\/images\/BlogImages\/About_D057\/TopOfTheWorld.jpg\",\"caption\":\"Cimares\"},\"sameAs\":[\"http:\/\/www.myfatblog.co.uk\"],\"url\":\"http:\/\/www.myfatblog.co.uk\/index.php\/author\/reginald\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Whats the record for the longest Calculated SharePoint column? - Blog of an overweight SharePoint addict","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/10\/whats-the-record-for-the-longest-calculated-sharepoint-column\/","og_locale":"en_US","og_type":"article","og_title":"Whats the record for the longest Calculated SharePoint column? - Blog of an overweight SharePoint addict","og_description":"Well my longest to date is 304 characters.. I&#8217;m not quite sure what the SharePoint limit is, but here&#8217;s mine&#8230; =IF(LEN(MONTH(Dated)\/3)=1,TEXT(Dated,&#8221;mmm-yy&#8221;),IF(LEN((MONTH(DATE(YEAR(Dated),MONTH(Dated)+1,DAY(Dated))))\/3)=1,TEXT(DATE(YEAR(Dated),MONTH(Dated)+1,DAY(Dated)),&#8221;mmm-yy&#8221;),IF(LEN((MONTH(DATE(YEAR(Dated),MONTH(Dated)+2,DAY(Dated))))\/3)=1,TEXT(DATE(YEAR(Dated),MONTH(Dated)+2,DAY(Dated)),&#8221;mmm-yy&#8221;),&#8221;ERR&#8221;))) &#8220;And what pray, does that monstrosity do&#8221;, I hear you ask&#8230; The answer is, it simply works out which quarter of the companies financial year the item appears in. The list item has a &hellip; Continue reading","og_url":"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/10\/whats-the-record-for-the-longest-calculated-sharepoint-column\/","og_site_name":"Blog of an overweight SharePoint addict","article_published_time":"2009-10-06T15:28:40+00:00","author":"Cimares","twitter_card":"summary_large_image","twitter_creator":"@cimares","twitter_site":"@cimares","twitter_misc":{"Written by":"Cimares","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/10\/whats-the-record-for-the-longest-calculated-sharepoint-column\/","url":"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/10\/whats-the-record-for-the-longest-calculated-sharepoint-column\/","name":"Whats the record for the longest Calculated SharePoint column? - Blog of an overweight SharePoint addict","isPartOf":{"@id":"http:\/\/www.myfatblog.co.uk\/#website"},"datePublished":"2009-10-06T15:28:40+00:00","dateModified":"2009-10-06T15:28:40+00:00","author":{"@id":"http:\/\/www.myfatblog.co.uk\/#\/schema\/person\/55ae8f6885bb5b8390dad001f3da83c6"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.myfatblog.co.uk\/index.php\/2009\/10\/whats-the-record-for-the-longest-calculated-sharepoint-column\/"]}]},{"@type":"WebSite","@id":"http:\/\/www.myfatblog.co.uk\/#website","url":"http:\/\/www.myfatblog.co.uk\/","name":"Blog of an overweight SharePoint addict","description":"The rantings of a (not so) food obsessed IT consultant!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.myfatblog.co.uk\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"http:\/\/www.myfatblog.co.uk\/#\/schema\/person\/55ae8f6885bb5b8390dad001f3da83c6","name":"Cimares","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.myfatblog.co.uk\/#\/schema\/person\/image\/","url":"http:\/\/www.myfatblog.co.uk\/images\/BlogImages\/About_D057\/TopOfTheWorld.jpg","contentUrl":"http:\/\/www.myfatblog.co.uk\/images\/BlogImages\/About_D057\/TopOfTheWorld.jpg","caption":"Cimares"},"sameAs":["http:\/\/www.myfatblog.co.uk"],"url":"http:\/\/www.myfatblog.co.uk\/index.php\/author\/reginald\/"}]}},"_links":{"self":[{"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/179"}],"collection":[{"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=179"}],"version-history":[{"count":3,"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/179\/revisions"}],"predecessor-version":[{"id":182,"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/179\/revisions\/182"}],"wp:attachment":[{"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=179"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/categories?post=179"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/tags?post=179"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}