I have the following formula field that uses nested if
statements:
IF
(
AND
(
NOT(ISBLANK(Last_SMS_Sent__c)),
NOT(ISBLANK(MobilePhone)),
NOT(ISBLANK(Est_Annual_Quantity__c)),
NOT(ISBLANK(Last_Call_Connect__c)),
NOT(ISBLANK(Intro_Sent_Id__c))
),
1.00,
IF
(
OR
(
AND
(
NOT(ISBLANK(Last_SMS_Sent__c)),
NOT(ISBLANK(MobilePhone)),
NOT(ISBLANK(Est_Annual_Quantity__c)),
NOT(ISBLANK(Last_Call_Connect__c))
),
AND
(
NOT(ISBLANK(MobilePhone)),
NOT(ISBLANK(Est_Annual_Quantity__c)),
NOT(ISBLANK(Last_Call_Connect__c)),
NOT(ISBLANK(Intro_Sent_Id__c))
),
AND
(
NOT(ISBLANK(Last_SMS_Sent__c)),
NOT(ISBLANK(Est_Annual_Quantity__c)),
NOT(ISBLANK(Last_Call_Connect__c)),
NOT(ISBLANK(Intro_Sent_Id__c))
),
AND
(
NOT(ISBLANK(Last_SMS_Sent__c)),
NOT(ISBLANK(MobilePhone)),
NOT(ISBLANK(Last_Call_Connect__c)),
NOT(ISBLANK(Intro_Sent_Id__c))
),
AND
(
NOT(ISBLANK(Last_SMS_Sent__c)),
NOT(ISBLANK(MobilePhone)),
NOT(ISBLANK(Est_Annual_Quantity__c)),
NOT(ISBLANK(Intro_Sent_Id__c))
)
),
0.80,
IF
(
OR
(
AND
(
NOT(ISBLANK(Last_SMS_Sent__c)),
NOT(ISBLANK(MobilePhone)),
NOT(ISBLANK(Est_Annual_Quantity__c))
),
AND
(
NOT(ISBLANK(MobilePhone)),
NOT(ISBLANK(Est_Annual_Quantity__c)),
NOT(ISBLANK(Last_Call_Connect__c))
),
AND
(
NOT(ISBLANK(Est_Annual_Quantity__c)),
NOT(ISBLANK(Last_Call_Connect__c)),
NOT(ISBLANK(Intro_Sent_Id__c))
),
AND
(
NOT(ISBLANK(Last_SMS_Sent__c)),
NOT(ISBLANK(Est_Annual_Quantity__c)),
NOT(ISBLANK(Last_Call_Connect__c))
),
AND
(
NOT(ISBLANK(Last_SMS_Sent__c)),
NOT(ISBLANK(Last_Call_Connect__c)),
NOT(ISBLANK(Intro_Sent_Id__c))
),
AND
(
NOT(ISBLANK(MobilePhone)),
NOT(ISBLANK(Last_Call_Connect__c)),
NOT(ISBLANK(Intro_Sent_Id__c))
),
AND
(
NOT(ISBLANK(Last_SMS_Sent__c)),
NOT(ISBLANK(MobilePhone)),
NOT(ISBLANK(Last_Call_Connect__c))
),
AND
(
NOT(ISBLANK(MobilePhone)),
NOT(ISBLANK(Est_Annual_Quantity__c)),
NOT(ISBLANK(Intro_Sent_Id__c))
),
AND
(
NOT(ISBLANK(Last_SMS_Sent__c)),
NOT(ISBLANK(Est_Annual_Quantity__c)),
NOT(ISBLANK(Intro_Sent_Id__c))
),
AND
(
NOT(ISBLANK(Last_SMS_Sent__c)),
NOT(ISBLANK(MobilePhone)),
NOT(ISBLANK(Intro_Sent_Id__c))
)
),
0.60,
IF
(
OR
(
AND
(
NOT(ISBLANK(Last_SMS_Sent__c)),
NOT(ISBLANK(MobilePhone))
),
AND
(
NOT(ISBLANK(MobilePhone)),
NOT(ISBLANK(Est_Annual_Quantity__c))
),
AND
(
NOT(ISBLANK(Est_Annual_Quantity__c)),
NOT(ISBLANK(Last_Call_Connect__c))
),
AND
(
NOT(ISBLANK(Last_SMS_Sent__c)),
NOT(ISBLANK(Est_Annual_Quantity__c))
),
AND
(
NOT(ISBLANK(Last_Call_Connect__c)),
NOT(ISBLANK(Intro_Sent_Id__c))
),
AND
(
NOT(ISBLANK(Last_SMS_Sent__c)),
NOT(ISBLANK(Est_Annual_Quantity__c))
),
AND
(
NOT(ISBLANK(Last_SMS_Sent__c)),
NOT(ISBLANK(Last_Call_Connect__c))
),
AND
(
NOT(ISBLANK(Last_SMS_Sent__c)),
NOT(ISBLANK(Intro_Sent_Id__c))
),
AND
(
NOT(ISBLANK(MobilePhone)),
NOT(ISBLANK(Last_Call_Connect__c))
),
AND
(
NOT(ISBLANK(MobilePhone)),
NOT(ISBLANK(Intro_Sent_Id__c))
),
AND
(
NOT(ISBLANK(Est_Annual_Quantity__c)),
NOT(ISBLANK(Intro_Sent_Id__c))
)
),
0.40,
IF
(
OR
(
NOT(ISBLANK(Last_SMS_Sent__c)),
NOT(ISBLANK(MobilePhone)),
NOT(ISBLANK(Est_Annual_Quantity__c)),
NOT(ISBLANK(Last_Call_Connect__c)),
NOT(ISBLANK(Intro_Sent_Id__c))
),
0.20,0.0
)
)
)
)
I've exceeded the max character length allowed in the formula. I'm trying to improve the algebraic logic so there isn't repetitive expressions and condense the number of characters used. I was trying to use a case statement instead, but no dice so far. When I removed the branch for the 20%, the formula saved and worked as intended, but it was missing the logic for calculating the 20%. Any formula gurus have a recommended better approach?
CASE ( IF(NOT(ISBLANK(Last_SMS_Sent__c)),1,0) + IF(NOT(ISBLANK(MobilePhone)),1,0) + IF(NOT(ISBLANK(Est_Annual_Quantity__c)),1,0) + IF(NOT(ISBLANK(Last_Call_Connect__c)),1,0) + IF(NOT(ISBLANK(Intro_Sent_Id__c)),1,0), 5,1.00, 4,0.80, 3,0.60, 2,0.40, 0.0 )
IF(ISBLANK(MyField__c), 0, 1)