+ Start a Discussion
Amanda JonesAmanda Jones 

Need a case statement to reduce compilation size

Hello!
So I have a big hairy formula that just keeps getting bigger.

I know that I can use the case function to reduce the compilation size, but can't figure out how to write it.

Here is the monster:

ISPICKVAL(Status, "Cancelled"),0,

IF((

ISPICKVAL (City__c,"Dallas, TX")&&NumberSent>10 && UP_Auto_Number_of_Nights__c>= 4||
ISPICKVAL(City__c,"Des Moines, IA")&&NumberSent>10 && UP_Auto_Number_of_Nights__c>= 4||
ISPICKVAL(City__c, "Kansas City, MO")&&NumberSent>10 && UP_Auto_Number_of_Nights__c>= 4||
ISPICKVAL(City__c, "Sioux Falls, SD")&&NumberSent>10 && UP_Auto_Number_of_Nights__c>= 4||
ISPICKVAL(City__c, "Ocean Beach, CA")&&NumberSent>10 && UP_Auto_Number_of_Nights__c>= 4||
ISPICKVAL(City__c, "Storm Lake, IA")&&NumberSent>10 && UP_Auto_Number_of_Nights__c>= 4||
ISPICKVAL(City__c, "Phoenix, AZ")&&NumberSent>10 && UP_Auto_Number_of_Nights__c>= 4||
ISPICKVAL(City__c, "Las Vegas, NV")&&NumberSent>10 && UP_Auto_Number_of_Nights__c>= 4||
ISPICKVAL(City__c, "Chicago, IL")&&NumberSent>10 && UP_Auto_Number_of_Nights__c>= 4||
ISPICKVAL(City__c, "Omaha, NE")&&NumberSent>=10 && UP_Auto_Number_of_Nights__c=2||
ISPICKVAL(City__c, "Lincoln, NE")&&NumberSent>10 && UP_Auto_Number_of_Nights__c>= 4
), 20.00*NumberSent,


IF(VALUE(TEXT(Year__c))>=2018 &&ISPICKVAL(City__c,"Omaha, NE")&&ISPICKVAL(Coordinator_First_Name__c,"Jordan")&& NOT(ISPICKVAL(Type, "JAP")), 165.00,

IF (VALUE(TEXT(Year__c))<=2018 &&ISPICKVAL(City__c,"Omaha, NE")&&ISPICKVAL(Coordinator_First_Name__c, "Marcus")&&NOT(ISPICKVAL(Type, "JAP")),75.00,

IF (VALUE(TEXT(Year__c))>=2019 &&ISPICKVAL(City__c,"Omaha, NE"),170.00,

IF (UP_Auto_Number_of_Nights__c<1 && NumberSent>10 ,5.00*NumberSent,

IF (UP_Auto_Number_of_Nights__c<1 && NumberSent<=10,5.00*10,

IF (UP_Auto_Number_of_Nights__c=2&& NumberSent<=10&&NOT(ISPICKVAL(Type, "JAP")), 15.00*10,

IF (UP_Auto_Number_of_Nights__c=2 && NumberSent>10&&NOT(ISPICKVAL(Type, "JAP")),15.00*NumberSent,

IF (UP_Auto_Number_of_Nights__c=3&& NumberSent<=10, 15.00*10,

IF (ISPICKVAL(Type, "JAP") &&  NumberSent<=9 && UP_Auto_Number_of_Nights__c=2, 200.00,

IF (ISPICKVAL(Type, "JAP") &&  NumberSent<=9 && UP_Auto_Number_of_Nights__c=5, 250.00,

IF( ISPICKVAL(City__c, "Omaha, NE")&&NumberSent>=10 && UP_Auto_Number_of_Nights__c=5&&ISPICKVAL(Type, "JAP"),25.00*NumberSent,

IF (UP_Auto_Number_of_Nights__c=3&& NumberSent>10,15.00*NumberSent,

 20.00*10

))))))))))))))

+
IF(Extra_Night__c=True,15.00,0)




Can anyone help me slay it? :-)