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
TC_UG_LeaderTC_UG_Leader 

Formula Field for Region Based on Zip Code or State

I have created a custom formula field on the Contact record that indicates which "market" the Contact resides in based on State and in some cases zip code.  A snippet of the code is listed here, however I need to add ALOT more zip info and when I attempt to do so, I quickly bump up against the 5000 character limit for formula fields.  Does anyone have any suggestions for how to minimize the characters I'm using and/or another way to get what I'm looking for?  I don't write APEX Code.

 

 

IF (OR(BEGINS(MailingPostalCode, "900"),BEGINS(MailingPostalCode, "90"),BEGINS(MailingPostalCode, "910"), BEGINS(MailingPostalCode, "911"), BEGINS(MailingPostalCode, "912"), BEGINS(MailingPostalCode, "913"), BEGINS(MailingPostalCode, "914"), BEGINS(MailingPostalCode, "915"), BEGINS(MailingPostalCode, "916"), BEGINS(MailingPostalCode, "917"), BEGINS(MailingPostalCode, "918")), "Los Angeles", IF(CONTAINS("MT:MN:ND:SD", MailingState), "MSP", IF(CONTAINS("AK:ID:OR:WA", MailingState), "SEA", IF(CONTAINS("ME:MA:NH:RI:VT", MailingState), "BOS", IF(CONTAINS("DC:D.C.:MD:VA:WV:DE", MailingState), "WDC", IF(CONTAINS("AL:FL:GA:MS:NC:SC:TN", MailingState), "ATZ", IF(CONTAINS("AR:NM:OK", MailingState), "DAL", IF(CONTAINS("NJ:NY", MailingState), "NYC", IF(CONTAINS("LA", MailingState), "HOU", IF(CONTAINS("CO:UT:WY", MailingState), "DEN", IF(CONTAINS("IL:IN:IA:MI:MO:NE:OH:WI:KS:KY", MailingState), "CHI", IF(ISBLANK(MailingState), "None","Other - State Missing"))))))))))))

 

THANKS!

werewolfwerewolf
May I suggest you do this with a data-driven Apex trigger instead?  That way you could make a custom object representing your mappings, and you won't end up with a huge and unwieldy formula field.