function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CRMGeneralistCRMGeneralist 

Help Understanding Formulas

I am trying to self teach myself formulas and one basic question is why do the ( ) have to be placed in weird spots when writing a formula, can anyone explain the rule or reason of where/when they are placed? I am good at copying or borrowing formulas but I actually want to learn how to write them and the logic. Anyone know of any good training or offer training? 
KC-CRM AnalystKC-CRM Analyst

It may seem confusing at first but, there is a method behind it all. I'm going to use psuedo code to prevent over complication

AND()  & OR() are used with parentheses around all the values that are contained.

Example:

AND(Owner=Bob,Builder=Ted,Supervisor=Jim) means Owner=Bob and Builder=Ted and Supervisor=Jim. 

OR(Owner=Bob,Owner=Ted,Owner=Jim) means Owner=Bob or Owner=Ted or Owner=Jim.

All commas that are processed by the AND() or OR() statement act as the controlling statement.

For every opening "(" you must have a closing ")".  Think of it like HTML without the tagging letters.

Another useful tip is to follow a format when building your formula:

IF(

  AND(

    OR(

      Owner=Bob,

      Owner=Ted,

      Owner=Jim

      ),

    Builder=Mike

   ),

 "Crew A",

 "Crew B"

)
 
This is a bit extreme for a very simple formula once you are getting good with writing your own formulas but, when reviewing large formulas from a support or troubleshooting view point it helps.


Message Edited by KC-CRM Analyst on 09-17-2008 01:15 AM
CRMGeneralistCRMGeneralist
That was a huge help!! I think I understand now how to approach them so thanks for the clarity!! Most of the time I can pick up on these things but for some reason I have been struggling a little.
KC-CRM AnalystKC-CRM Analyst

One other thing that is important to learn is actually more of an interpretation issue. 

When using the Check Syntax button, the syntax errors it throws are not always correct but, they are indicative of the problem.

Try removing a comma or a ")" from the middle of a formula you know works.  Look at the syntax error that is shown.

There are several different ways in which the syntax evaluation can read the code.  As soon as you recognize the errors that are thrown and what they actulally mean, you are well on your way to formula expertise.