I have a Custom Field formula that spits out different naming conventions according to specific rules. The main issue I'm having is when I try to add additional IF statements, my compiled formula goes over the 5,000 character limit. Is there anyway to shorten the below formula in order to add new naming conventions for different clients? I know that the date can be shortened to TEXT(Date field), but the format that gives me is not ideal since I want MM.DD.YY. Would using a CASE function lower the character count?
IF(
AND(CONTAINS(Account.Parent.Name ,"CLIENT1")= TRUE,
ISBLANK(Combo_Event_1__c)=FALSE,
ISBLANK(Flight_Name__c)=TRUE),
Show_Code__r.Name & "_" &
SUBSTITUTE(Combo_Event_1__r.VenueCity__c," ","") & "-" &
SUBSTITUTE(Combo_Event_2__r.VenueCity__c," ","") & "_" &
TEXT(Month(Show_Close_Date__c)) & "." &
TEXT(DAY(Show_Close_Date__c)) & "." &
Right(text(YEAR(Show_Close_Date__c)),2) & "_" &
"CustomName" & "_" &
ID__c
,
IF(
AND(CONTAINS(Account.Parent.Name ,"CLIENT1")= TRUE,
ISBLANK(Combo_Event_1__c)=FALSE,
ISBLANK(Flight_Name__c)=FALSE),
Show_Code__r.Name & "_" &
SUBSTITUTE(Combo_Event_1__r.VenueCity__c," ","") & "-" &
SUBSTITUTE(Combo_Event_2__r.VenueCity__c," ","") & "-" &
SUBSTITUTE(Flight_Name__c," ","") & "_" &
TEXT(Month(Show_Close_Date__c)) & "." &
TEXT(DAY(Show_Close_Date__c)) & "." &
Right(text(YEAR(Show_Close_Date__c)),2) & "_" &
"CustomName" & "_" &
ID__c
,
IF(
AND(CONTAINS(Account.Parent.Name ,"CLIENT1")= TRUE,
ISBLANK(Combo_Event_1__c)=TRUE,
ISBLANK(Flight_Name__c)=TRUE),
Show_Code__r.Name & "_" &
SUBSTITUTE(VenueCity__c," ","") & "_" &
TEXT(Month(Show_Close_Date__c)) & "." &
TEXT(DAY(Show_Close_Date__c)) & "." &
Right(text(YEAR(Show_Close_Date__c)),2) & "_" &
"CustomName" & "_" &
ID__c
,
IF(
AND(CONTAINS(Account.Parent.Name ,"CLIENT1")= TRUE,
ISBLANK(Combo_Event_1__c)=TRUE,
ISBLANK(Flight_Name__c)=FALSE),
Show_Code__r.Name & "_" &
SUBSTITUTE(VenueCity__c," ","") & "_" &
TEXT(Month(Show_Close_Date__c)) & "." &
TEXT(DAY(Show_Close_Date__c)) & "." &
Right(text(YEAR(Show_Close_Date__c)),2) & "_" &
"CustomName" & "_" &
ID__c
,
IF(
AND(CONTAINS(Account.Parent.Name ,"CLIENT2")= TRUE,
ISBLANK(Flight_Name__c)=TRUE),
Show_Code__r.Name & "_" &
SUBSTITUTE(VenueCity__c," ","") & "_" &
TEXT(Month(Show_Close_Date__c)) & "." &
TEXT(DAY(Show_Close_Date__c)) & "." &
Right(text(YEAR(Show_Close_Date__c)),2) & "_" &
"CustomName" & "_" &
ID__c
,
IF(
AND(CONTAINS(Account.Parent.Name ,"CLIENT2")= TRUE,
ISBLANK(Flight_Name__c)=FALSE),
Show_Code__r.Name & "_" &
SUBSTITUTE(VenueCity__c," ","") & "-" &
SUBSTITUTE(Flight_Name__c," ","") & "_" &
TEXT(Month(Show_Close_Date__c)) & "." &
TEXT(DAY(Show_Close_Date__c)) & "." &
Right(text(YEAR(Show_Close_Date__c)),2) & "_" &
"CustomName" & "_" &
ID__c
,
IF(
AND(CONTAINS(Account.Parent.Name,"CLIENT3")= TRUE),
Account.Name & "_" &
'FY' &
RIGHT(TEXT( YEAR( Target_End_Date__c ) + IF( MONTH( Target_End_Date__c ) > 6, 1, 0)), 2) & "_" &
TEXT(Tactic__c) & "_" &
SUBSTITUTE(Flight_Name__c," ","") & "_" &
ID__c
,
""
)))))))
Any suggestions are much appreciated.
SOLUTION - this lowered the character count by over 1000 in SF. There is most likely more room for optimization:
IF(CONTAINS(Account.Parent.Name,"CLIENT1"),
IF(ISBLANK(Combo_Event_1__c),
IF(ISBLANK(Flight_Name__c),
Show_Code__r.Name & "_" &
SUBSTITUTE(VenueCity__c," ","") & "_" &
TEXT(Month(Show_Close_Date__c)) & "." &
TEXT(DAY(Show_Close_Date__c)) & "." &
Right(text(YEAR(Show_Close_Date__c)),2) & "_" &
"TACTIC" & "_" &
ID__c
,
Show_Code__r.Name & "_" &
SUBSTITUTE(VenueCity__c," ","") & "_" &
TEXT(Month(Show_Close_Date__c)) & "." &
TEXT(DAY(Show_Close_Date__c)) & "." &
Right(text(YEAR(Show_Close_Date__c)),2) & "_" &
"TACTIC" & "_" &
ID__c
),
IF(ISBLANK(Flight_Name__c),
Show_Code__r.Name & "_" &
SUBSTITUTE(Combo_Event_1__r.VenueCity__c," ","") & "-" &
SUBSTITUTE(Combo_Event_2__r.VenueCity__c," ","") & "_" &
TEXT(Month(Show_Close_Date__c)) & "." &
TEXT(DAY(Show_Close_Date__c)) & "." &
Right(text(YEAR(Show_Close_Date__c)),2) & "_" &
"TACTIC" & "_" &
ID__c
,
Show_Code__r.Name & "_" &
SUBSTITUTE(Combo_Event_1__r.VenueCity__c," ","") & "-" &
SUBSTITUTE(Combo_Event_2__r.VenueCity__c," ","") & "-" &
SUBSTITUTE(Flight_Name__c," ","") & "_" &
TEXT(Month(Show_Close_Date__c)) & "." &
TEXT(DAY(Show_Close_Date__c)) & "." &
Right(text(YEAR(Show_Close_Date__c)),2) & "_" &
"TACTIC" & "_" &
ID__c
)),
IF(CONTAINS(Account.Parent.Name,"CLIENT2"),
IF(ISBLANK(Flight_Name__c),
Show_Code__r.Name & "_" &
SUBSTITUTE(VenueCity__c," ","") & "_" &
TEXT(Month(Show_Close_Date__c)) & "." &
TEXT(DAY(Show_Close_Date__c)) & "." &
Right(text(YEAR(Show_Close_Date__c)),2) & "_" &
"TACTIC" & "_" &
ID__c
,
Show_Code__r.Name & "_" &
SUBSTITUTE(VenueCity__c," ","") & "-" &
SUBSTITUTE(Flight_Name__c," ","") & "_" &
TEXT(Month(Show_Close_Date__c)) & "." &
TEXT(DAY(Show_Close_Date__c)) & "." &
Right(text(YEAR(Show_Close_Date__c)),2) & "_" &
"TACTIC" & "_" &
ID__c
),
IF(CONTAINS(Account.Parent.Name,"CLIENT3"),
Account.Name & "_" &
'FY' &
RIGHT(TEXT(YEAR(Target_End_Date__c)+IF(MONTH(Target_End_Date__c)>6,1,0)),2) & "_" &
TEXT(Digital_Tactic__c) & "_" &
SUBSTITUTE(Flight_Name__c," ","") & "_" &
ID__c
,
IF(CONTAINS(Account.Parent.Name,"CLIENT4"),
Account.Name & "_" &
'FY' &
RIGHT(TEXT(YEAR(Target_Campaign_End_Date__c)+IF(MONTH(Target_Campaign_End_Date__c)>6,1,0)),2) & "_" &
TEXT(Month(Target_Campaign_End_Date__c)) & "." &
TEXT(DAY(Target_Campaign_End_Date__c)) & "." &
Right(text(YEAR(Target_Campaign_End_Date__c)),2) & "_" &
"TACTIC" & "_" &
ID__c
,
IF(CONTAINS(Account.Name,"CLIENT5"),
Account.Name & "_" &
TEXT(YEAR(Target_Campaign_End_Date__c)) & "_" &
TEXT(Month(Target_Campaign_End_Date__c)) & "." &
TEXT(DAY(Target_Campaign_End_Date__c)) & "." &
Right(text(YEAR(Target_Campaign_End_Date__c)),2) & "_" &
"TACTIC" & "_" &
ID__c
,
""
)))))