City State Country

With State and Country Picklists

Accounts

IF(NOT(ISBLANK(ShippingCity)),ShippingCity+" ","")+ IF(NOT(ISBLANK(TEXT(ShippingStateCode))),TEXT(ShippingStateCode)+" ","")+ IF(NOT(ISBLANK(TEXT(ShippingCountryCode))),TEXT(ShippingCountryCode)+" ", IF(NOT(ISBLANK(BillingCity)),BillingCity+" ","")+ IF(NOT(ISBLANK(TEXT(BillingStateCode))),TEXT(BillingStateCode)+" ","")+ IF(NOT(ISBLANK(TEXT(BillingCountryCode))),TEXT(BillingCountryCode)+" ", ""))

Contacts

IF(NOT(ISBLANK(OtherCity)),OtherCity+" ","")+ IF(NOT(ISBLANK(TEXT(OtherStateCode))),TEXT(OtherStateCode)+" ","")+ IF(NOT(ISBLANK(TEXT(OtherCountryCode))),TEXT(OtherCountryCode)+" ", IF(NOT(ISBLANK(MailingCity)),MailingCity+" ","")+ IF(NOT(ISBLANK(TEXT(MailingStateCode))),TEXT(MailingStateCode)+" ","")+ IF(NOT(ISBLANK(TEXT(MailingCountryCode))),TEXT(MailingCountryCode)+" ", ""))

Without State and Country Picklists

Accounts

IF(NOT(ISBLANK(ShippingCity)),ShippingCity+" ","")+  IF(NOT(ISBLANK(ShippingState)),ShippingState+" ","")+  IF(NOT(ISBLANK(ShippingCountry)),ShippingCountry+" ",  IF(NOT(ISBLANK(BillingCity)),BillingCity+" ","")+  IF(NOT(ISBLANK(BillingState)),BillingState+" ","")+  IF(NOT(ISBLANK(BillingCountry)),BillingCountry+" ",  ""))


Or depending on how much garbage you have in your Addresses, then you may need to reduce the formula to under 76 Characters to show it on a list view - yep, that's a thing apparently. So I also removed the Country if it's Aus

Contacts

State Only

For Australia and New Zealand, and only showing State Codes - ideal for integration with other apps.

NOTE

  • Sometimes you might want to include the Account City State and Country in the Contact formula also - so if Contact is blank, it gets the details from the Account. 

  • Use this field in all cases in list views rather than Mailing State

  • I often remove the second address on Contacts, so modify this formula to suit. 

  • If you are using NPSP address management, then this might not be correct. 

  • You should always enable State and Country Picklists unless you have a recalcitrant app that has not enabled it yet - get onto them, there is no excuse! 

  • Rename your State and Country fields away from Shipping and Billing - see Organisations