First formula:
There are a few different operators here. I'll start from the top of the first formula and work my way down. The first formula starts with an IF function, which has three parameters. Call them A, B, C. In this case, A is the block that starts with AND, B starts with NOT, and C starts with IF. IF evaluates the initial condition (A), and returns B if (A == true), or C if (A == false).
Another operator that appears is AND. AND returns true if all of its conditions are true.
It sounds complicated, it's helpful to break compound formulas like these up into pieces. Here is the formula again with indentations and annotations to help explain (comments marked by ###):
The first formula with notes:
IF( ### our initial IF which
will evaluate A, and
return B if true,
C if false
AND( ### this is A.
Amount > 100000,
ISPICKVAL(StageName, "Closed Won")
),
NOT( ### this is B.
AND(
Amount<= Credit_Approved_Amount__c,
TODAY()<= Credit_Expiration_Date__c,
ISPICKVAL( Credit_Status__c, "Approved")
)
),
IF( ### this is C
ISBLANK(Comm_Type__c), ### this is CA
NOT( ### this is CB
AND(
Amount<= Credit_Approved_Amount__c,
TODAY()<= Credit_Expiration_Date__c,
ISPICKVAL( Credit_Status__c, "Approved")
)
)
,
FALSE ### this is CC
)
)
So since A is using an AND operator, for A to be true, Amount must be greater than 100000 and StageName must be 'Closed Won.' If only one is true and the other is false, A will be false.
So let's say A is true, then we return B. To determine the value of B, you'll see that there is another AND, wrapped with a NOT. Start with the inner AND - if all three of these statements are true (Amount less than or equal to the value of the field Credit_Approved_Amount__c, Credit_Expiration_Date__c earlier than today, Credit_Status__c is 'Approved'), then the AND will return true. Otherwise, return false. The NOT that wraps this AND means that whatever the AND operator returns, the NOT returns the opposite. So if all three of these statements are true, the AND will return true, but the NOT will return false.
If A is false, then we return C. C begins with another IF. Remember that the IF operator evaluates its first parameter (CA), and returns its second parameter (CB) if true, the third (CC) if false. In this case, you'll see that CB matches our inner formula B exactly, which I explained above. So if CA is true (Comm_Type__c is blank), CB is returned. Otherwise, CC is returned, which is just a nice clean 'false' in this case.
Second formula:
The second formula is actually much simpler. The || operator performs the same function as OR, meaning that it returns true if any of its component statements are true. For example, if you had OR(A, B, C, D) and A B and C were false, but D was true, then the whole OR would return true. For this second forumla, if StageName is 'Closed & Booked' and ANY one or more of the following statements are true, then the whole formula will return true.
AND (
ISPICKVAL(StageName, "Closed & Booked"),
(
Credit_Approved_Amount__c < Amount
||
Credit_Expiration_Date__c < TODAY ()
||
ISPICKVAL(Credit_Status__c, "Waiting for More Info")
||
ISPICKVAL(Credit_Status__c, "Declined")
||
LEN(Account.GP_Customer_Id__c) = 0
||
ISBLANK(Credit_Approved_Amount__c)
||
ISBLANK( Credit_Expiration_Date__c )
||
ISPICKVAL( Credit_Status__c , "")
)
)