Stump the Panel Topic: Calculated Column Formula - Challenge! http://www.endusersharepoint.com/STP/ Paul Grenier, Lead Moderator en Tue, 10 Feb 2009 10:37:07 +0000 AutoSponge on "Calculated Column Formula - Challenge!" http://www.endusersharepoint.com/STP/topic/calculated-column-formula-challenge#post-4059 Mon, 09 Feb 2009 22:21:32 +0000 AutoSponge 4059@http://www.endusersharepoint.com/STP/ <p>mtkammerait,</p> <p>the construction is &lt;condition&gt;,true,false so everywhere we have a "dangling false" we can place "" and that should do it.</p> <p>Try this:<br /> <pre><code>IF([Class of Mail]=&quot;Standard&quot;, IF([Rate Type]=&quot;Flat&quot;,&quot;Comail&quot;,&quot;&quot;)&#38; IF([Rate Type]=&quot;Letter&quot;, IF([Circulation]&gt;800000, &quot;Comingle&quot;,&quot;Distribution&quot; ),&quot;&quot; ) )&#38; IF([Class of Mail]=&quot;First Class&quot;, IF([Rate Type]=&quot;Flat&quot;,&quot;Distribution&quot;,&quot;&quot;)&#38; IF([Rate Type]=&quot;Letter&quot;,&quot;Comingle&quot;,&quot;&quot;),&quot;&quot; )&#38; IF([Class of Mail]=&quot;Package Services&quot;, &quot;Distribution&quot;,&quot;&quot;)</code></pre> mtkammerait on "Calculated Column Formula - Challenge!" http://www.endusersharepoint.com/STP/topic/calculated-column-formula-challenge#post-4038 Mon, 09 Feb 2009 11:46:08 +0000 mtkammerait 4038@http://www.endusersharepoint.com/STP/ <p>First of all... Thank you, Thank you, Thank you!</p> <p>You've gotten me much closer. However, I've hit another snag.</p> <p>With slight modification of the formula you provided, I can get an output that CONTAINS the output I need. However, it also contains FALSE for each if statement that returns false. So, if the desired output is distribution, I'm getting FALSEFALSEDistribution or FALSEDistributionFALSEFALSE, or something to that effect for each one. is there a way to have the output set to nothing rather than FALSE if the output comes back FALSE? That way my output would be just Comingle, Distribution, Comail, etc. Or, is there a way to use another column to "clean up" this column, I've been trying this but can't seem to find a way to write a column that says "If this column CONTAINS Distribution, to give the output "Distribution" or if this column CONTAINS Comail, to give the output "Comail." Any ideas? </p> AutoSponge on "Calculated Column Formula - Challenge!" http://www.endusersharepoint.com/STP/topic/calculated-column-formula-challenge#post-4024 Fri, 06 Feb 2009 19:17:28 +0000 AutoSponge 4024@http://www.endusersharepoint.com/STP/ <p>You can't have more than 7 nested IF statements. But it looks like you have 7, so we might be ok. Now to check the syntax:</p> <p><code>IF([Class of Mail]=Periodical,&quot;Distribution&quot;),...</code></p> <p>You don't need a comma here unless you're wrapping everything up with another function. Instead, let's use '&#38;'.</p> <p><code>IF([Class of Mail]=Periodical,&quot;Distribution&quot;)&#38;...</code></p> <p>Next, you can combine some of these but we might want to edit it later, so it's easier if we don't (like IF Periodical OR Package Services, THEN Distribution).</p> <p>However, we can rewrite the branching IF statements to make them easier to manage:</p> <pre><code>IF([Class of Mail]=&quot;Standard&quot;, IF([Rate Type]=&quot;Flat&quot;,&quot;Comail&quot;)&#38; IF([Rate Type]=&quot;Letter&quot;, IF([Circulation]&gt;800000, &quot;Comingle&quot;,&quot;Distribution&quot; ) ) )&#38; IF([Class of Mail]=&quot;First Class&quot;, IF([Rate Type]=&quot;Flat&quot;,&quot;Distribution&quot;)&#38; IF([Rate Type]=&quot;Letter&quot;,&quot;Comingle&quot;) )&#38; IF([Class of Mail]=&quot;Package Services&quot;, &quot;Distribution&quot;)</code></pre> <p>Let's walk through the logic:</p> <p>1. IF [Class of Mail]... If we pick any value for this, we should get only one path to follow. So, our &#38; (concat) will not return "DistributionDistribution".<br /> 2. After choosing a path, we look at Rate Type. Again, we can use &#38; because we only allow one choice per branch.<br /> 3. Inside Rate Type, we check Circulation (which we cheat on at the end by using the 'else' condition after our IF-TRUE result.</p> <p>We can repeat this pattern as needed. </p> <p>When we flatten it out, it looks like this:</p> <p><code>IF([Class of Mail]=&quot;Standard&quot;,IF([Rate Type]=&quot;Flat&quot;,&quot;Comail&quot;)&#38;IF([Rate Type]=&quot;Letter&quot;,IF([Circulation]&gt;800000,&quot;Comingle&quot;,&quot;Distribution&quot;)))&#38;IF([Class of Mail]=&quot;First Class&quot;,IF([Rate Type]=&quot;Flat&quot;,&quot;Distribution&quot;)&#38;IF([Rate Type]=&quot;Letter&quot;,&quot;Comingle&quot;))&#38;IF([Class of Mail]=&quot;Package Services&quot;,&quot;Distribution&quot;)</code></p> <p>Try that out and see if it helps. </p> mtkammerait on "Calculated Column Formula - Challenge!" http://www.endusersharepoint.com/STP/topic/calculated-column-formula-challenge#post-4015 Fri, 06 Feb 2009 14:38:01 +0000 mtkammerait 4015@http://www.endusersharepoint.com/STP/ <p>Alright, this one is admittedly a doozy but I'll be forever indebted if you can help me figure it out. I'm writing a calculated column formula and I need some help. The formula is for an estimate request system I'm building using a custom list. Based on 2-3 different criteria, I'm populating an auto assign column which will decide which of 3 groups needs to do the estimate. Here's the logic I'm trying to encompass and the IF statements I wrote for each one so far.</p> <p>IF Periodical, THEN Distribution ----- IF([Class of Mail]=Periodical),"Distribution",</p> <p>IF Standard AND Flat, THEN Comail ----- IF(AND([Class of Mail]=Standard,[Rate Type]=Flat)),"Comail",</p> <p>IF Standard AND Letter AND &gt;800000, THEN Comingle ----- IF(AND(AND([Class of Mail]=Standard,[Rate Type]=Letter),[Circulation]&gt;800000)),”Comingle”,</p> <p>IF Standard AND Letter AND &lt;800000, THEN Distribution ----- IF(AND(AND([Class of Mail]=Standard,[Rate Type]=Letter),[Circulation]&lt;800000)),”Distribution”,</p> <p>IF First Class AND Flat, THEN Distribution ----- IF(AND([Class of Mail]=First Class,[Rate Type]=Flat)),”Distribution”,</p> <p>IF First Class AND Letter, THEN Comingle ----- IF(AND([Class of Mail]=First Class,[Rate Type]=Letter)),”Comingle”,</p> <p>IF Package Services, THEN Distribution ----- IF([Class of Mail]=Package Services),”Distribution”</p> <p>So the final formula for the whole system comes to:</p> <p>IF([Class of Mail]=Periodical,"Distribution"),IF(AND([Class of Mail]=Standard,[Rate Type]=Flat),"Comail",IF(AND(AND([Class of Mail]=Standard,[Rate Type]=Letter),[Circulation]&gt;800000)),"Comingle",IF(AND(AND([Class of Mail]=Standard,[Rate Type]=Letter),[Circulation]&lt;800000)),"Distribution",IF(AND([Class of Mail]=First Class,[Rate Type]=Flat)),"Distribution",IF(AND([Class of Mail]=First Class,[Rate Type]=Letter)),"Comingle",IF([Class of Mail]=Package Services),"Distribution"</p> <p>But (of course) I'm getting a syntax error. If anyone can find my error(s) I will be incredibly greatful. </p> <p>A few ideas I have on what it might be: I typed the names of the columns instead of double clicking them in the list (they're identical, but I don't know if it might cause a problem to type them) Also, I'm not sure you can use an AND( within and AND(, does anyone know this? If that's not allowed, do you know another way to have 3 conditions for an IF statement?</p> <p>Please keep in mind I'm (unfortunately) working with WSS, not MOSS.</p> <p>Thanks in advance for any help anyone might be able to provide. </p>