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
Chris PickingChris Picking 

Combine IF statements

I'm trying to take this statment and then add the second block so that it all works together, but no matter how I try it I get syntax errors of varying types. 
IF(Desired_Record_Type__c = "Lead", 
IF(NOT(isBlank(SSN__c)) || (NOT(isBlank(First_Name_Override__c )) && NOT(isBlank(LastName)) && (NOT(isBlank(Mobile_Phone_Override__c )) || NOT(isBlank(Primary_Email_Override__c)))), true, false ), IF(NOT(isBlank(LastName)) && (NOT(ISBLANK(Mobile_Phone__c)) || (NOT(isBlank(Email)) && NOT(isBlank(Brand__c))) || (NOT(isBlank(Email)) && NOT(isBlank(Company)))), true, false ) )
 
IF(Desired_Record_Type__c = "Prospect",  
IF(NOT(isBlank(First_Name_Override__c  )) && NOT(isBlank(LastName)),  true,  false  ), IF(NOT(isBlank(LastName)) && (NOT(ISBLANK(Mobile_Phone__c)) || (NOT(isBlank(Email)) && NOT(isBlank(Brand__c))) || (NOT(isBlank(Email)) && NOT(isBlank(Company)))),  true,  false  ) )


Any help on combining the two would greatly be appreciated. 
Best Answer chosen by Chris Picking
Arpit Jain7Arpit Jain7
Hi Chris,

It seems you want to put the mentioned 2 if blocks together in formula.I am assumming your formula return type is Checkbox i.e. boolean then you can try something like below
IF(Desired_Record_Type__c = "Lead", IF(NOT(isBlank(SSN__c)) || (NOT(isBlank(First_Name_Override__c )) && NOT(isBlank(LastName)) && (NOT(isBlank(Mobile_Phone_Override__c )) || NOT(isBlank(Primary_Email_Override__c)))), true, false ), IF(NOT(isBlank(LastName)) && (NOT(ISBLANK(Mobile_Phone__c)) || (NOT(isBlank(Email)) && NOT(isBlank(Brand__c))) || (NOT(isBlank(Email)) && NOT(isBlank(Company)))), true, false ) ) &&
IF(Desired_Record_Type__c = "Prospect",  IF(NOT(isBlank(First_Name_Override__c  )) && NOT(isBlank(LastName)),  true,  false  ), IF(NOT(isBlank(LastName)) && (NOT(ISBLANK(Mobile_Phone__c)) || (NOT(isBlank(Email)) && NOT(isBlank(Brand__c))) || (NOT(isBlank(Email)) && NOT(isBlank(Company)))),  true,  false  ) )

In this way you can add multiple If blocks together.

Hope this can help !!

Thanks
Arpit
 

All Answers

Arpit Jain7Arpit Jain7
Hi Chris,

It seems you want to put the mentioned 2 if blocks together in formula.I am assumming your formula return type is Checkbox i.e. boolean then you can try something like below
IF(Desired_Record_Type__c = "Lead", IF(NOT(isBlank(SSN__c)) || (NOT(isBlank(First_Name_Override__c )) && NOT(isBlank(LastName)) && (NOT(isBlank(Mobile_Phone_Override__c )) || NOT(isBlank(Primary_Email_Override__c)))), true, false ), IF(NOT(isBlank(LastName)) && (NOT(ISBLANK(Mobile_Phone__c)) || (NOT(isBlank(Email)) && NOT(isBlank(Brand__c))) || (NOT(isBlank(Email)) && NOT(isBlank(Company)))), true, false ) ) &&
IF(Desired_Record_Type__c = "Prospect",  IF(NOT(isBlank(First_Name_Override__c  )) && NOT(isBlank(LastName)),  true,  false  ), IF(NOT(isBlank(LastName)) && (NOT(ISBLANK(Mobile_Phone__c)) || (NOT(isBlank(Email)) && NOT(isBlank(Brand__c))) || (NOT(isBlank(Email)) && NOT(isBlank(Company)))),  true,  false  ) )

In this way you can add multiple If blocks together.

Hope this can help !!

Thanks
Arpit
 
This was selected as the best answer
Arpit Jain7Arpit Jain7
Hello Chris,

Just wanted to check if above solution provided helped you or not. If it does please mark it as Best Answer, so that it can help others also with the same problem.

Thanks
​Arpit