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
Amanda JonesAmanda Jones 

How to connect multiple IF statements.

Hello!

Need a little help here.

I have several formula fields on an object that I need to condense to one field. I have several because compilation limits prevented me from including all of my IF statements in one formula field, so now I decided to use a workflow rule.

Below I have pasted all of the formulas that are currently calculating values on four different formula fields.

How do I string them together so that I can get each calculation to run in one field? It's named Total Cost.

Thanks in advance!


IF(Couple__c=True&&ISPICKVAL(Deployment_No__c, "1")&&New_Pricing__c=False,(STIMonthlyCostcurrency__c+ STIDailyCostcurrency__c+GA_Addtl_Cost__c+91)*2+ Donor_Elf_Fee__c,0)

IF(Couple__c=True&&ISPICKVAL(Deployment_No__c, "1")&&New_Pricing__c=True,(GAMonthlyCostcurrency__c + GADailyCostcurrency__c +GA_Addtl_Cost__c+91)*2+ Donor_Elf_Fee__c,0)

IF(ISPICKVAL(Deployment_No__c,"1")&&ISBLANK(StartDate)|| New_Pricing__c=True||Couple__c =True||NOT(ISPICKVAL(Deployment_No__c,"1"))&&Total_Amount_Received__c>26,0,91+STIMonthlyCostcurrency__c+ STIDailyCostcurrency__c+ GA_Addtl_Cost__c-Applied_Credit__c+ Donor_Elf_Fee__c)

IF(ISPICKVAL(Deployment_No__c,"1")&&ISBLANK(StartDate)||Couple__c =True||NOT(ISPICKVAL(Deployment_No__c,"1"))||New_Pricing__c=False&& Total_Amount_Received__c>26,0,91+GAMonthlyCostcurrency__c + GADailyCostcurrency__c + GA_Addtl_Cost__c-Applied_Credit__c+ Donor_Elf_Fee__c)

IF(Couple__c=True&&NOT(ISPICKVAL( Deployment_No__c,"1"))&&New_Pricing__c=False,(STIMonthlyCostcurrency__c+ STIDailyCostcurrency__c+GA_Addtl_Cost__c)*2+Donor_Elf_Fee__c,0)

IF(Couple__c=True&&NOT(ISPICKVAL( Deployment_No__c,"1")),(GAMonthlyCostcurrency__c + GADailyCostcurrency__c +GA_Addtl_Cost__c)*2+Donor_Elf_Fee__c,0)

IF(Couple__c=True||(ISPICKVAL(Deployment_No__c,"1"))||New_Pricing__c=True&&NOT(ISPICKVAL(Deployment_No__c,"1")),0, STIMonthlyCostcurrency__c + STIDailyCostcurrency__c +GA_Addtl_Cost__c-Applied_Credit__c+ Donor_Elf_Fee__c)

IF(Couple__c=False&&NOT(ISPICKVAL(Deployment_No__c,"1"))||New_Pricing__c=True&&NOT(ISPICKVAL(Deployment_No__c,"1")), GAMonthlyCostcurrency__c + GADailyCostcurrency__c +GA_Addtl_Cost__c-Applied_Credit__c+ Donor_Elf_Fee__c,
Best Answer chosen by Amanda Jones
Tarun J.Tarun J.
Hello Amanda,

Assuming all IFs are returning same type (Currency or Number), you can add '+' sign after each IF block and you will get sum of all of them. Something like below:
 
IF(Couple__c = True && ISPICKVAL(Deployment_No__c, "1") && New_Pricing__c = False, (STIMonthlyCostcurrency__c + STIDailyCostcurrency__c + GA_Addtl_Cost__c + 91)*2+ Donor_Elf_Fee__c, 0) +
IF(Couple__c=True&&ISPICKVAL(Deployment_No__c, "1")&&New_Pricing__c=True,(GAMonthlyCostcurrency__c + GADailyCostcurrency__c +GA_Addtl_Cost__c+91)*2+ Donor_Elf_Fee__c,0)
+
IF(ISPICKVAL(Deployment_No__c,"1")&&ISBLANK(StartDate)|| New_Pricing__c=True||Couple__c =True||NOT(ISPICKVAL(Deployment_No__c,"1"))&&Total_Amount_Received__c>26,0,91+STIMonthlyCostcurrency__c+ STIDailyCostcurrency__c+ GA_Addtl_Cost__c-Applied_Credit__c+ Donor_Elf_Fee__c)
+
IF(ISPICKVAL(Deployment_No__c,"1")&&ISBLANK(StartDate)||Couple__c =True||NOT(ISPICKVAL(Deployment_No__c,"1"))||New_Pricing__c=False&& Total_Amount_Received__c>26,0,91+GAMonthlyCostcurrency__c + GADailyCostcurrency__c + GA_Addtl_Cost__c-Applied_Credit__c+ Donor_Elf_Fee__c)
+
IF(Couple__c=True&&NOT(ISPICKVAL( Deployment_No__c,"1"))&&New_Pricing__c=False,(STIMonthlyCostcurrency__c+ STIDailyCostcurrency__c+GA_Addtl_Cost__c)*2+Donor_Elf_Fee__c,0)
+
IF(Couple__c=True&&NOT(ISPICKVAL( Deployment_No__c,"1")),(GAMonthlyCostcurrency__c + GADailyCostcurrency__c +GA_Addtl_Cost__c)*2+Donor_Elf_Fee__c,0)
+
IF(Couple__c=True||(ISPICKVAL(Deployment_No__c,"1"))||New_Pricing__c=True&&NOT(ISPICKVAL(Deployment_No__c,"1")),0, STIMonthlyCostcurrency__c + STIDailyCostcurrency__c +GA_Addtl_Cost__c-Applied_Credit__c+ Donor_Elf_Fee__c)
+
IF(Couple__c=False&&NOT(ISPICKVAL(Deployment_No__c,"1"))||New_Pricing__c=True&&NOT(ISPICKVAL(Deployment_No__c,"1")), GAMonthlyCostcurrency__c + GADailyCostcurrency__c +GA_Addtl_Cost__c-Applied_Credit__c+ Donor_Elf_Fee__c,0)

-Thanks,
TK

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.