+ Start a Discussion
Jeff OnsrudJeff Onsrud 

Error: Formula result is data type (Location), incompatible with expected data type (Text)

I am trying to create a field that shows consolidated address information based on which field has information in it. Show the Shipping Address unless it is blank, then show the Billing Address. I want to make several separate fields - Address, City, State, ZIP, Country. I am getting the error: "Formula result is data type (Location), incompatible with expected data type (Text)".

My formula is: IF(  ISBLANK( ShippingAddress ) ,  BillingAddress , ShippingAddress)

There is no option in Formula to make the type "Location" only "Text".

Any help on how to make the formula would be appreciated.
David ZhuDavid Zhu
ShippingAddress and BillingAddress are "Address" data type. Address datat type is a compound data type which is not supported by formula so far.

You may need to check this:
http://www.salesforce.com/us/developer/docs/api/Content/compound_fields_address.htm
 
Jeff OnsrudJeff Onsrud
David, thanks for the quick reply last week. I appreciate the reference but unfortunately am not much of a coder.

Does anyone know of a work around way to accomplish the goal (of a formula field that shows 1 of 2 addresses depending on if one is filled in or not)?
Ravi KatraguntaRavi Katragunta
Hi, 
I am not sure you have fixed the issue or not: Here is solution and it may work for you:
IF(  ISBLANK( ShippingAddress ) ,  BillingStreet+Br()+BillingCity+BR()+BillingState+' '+BillingPostalCode , ShippingStreet+Br()+ShippingCity+BR()+ShippingState+' '+ShippingPostalCode)
Ramesh Reddy 98Ramesh Reddy 98
Hi, 
This might be useful. If one need to bring in the mailing address from account to custom object via lookup field then one can use the below 

Create a custom field on the Custom object. 
Datatype = FORMULA 
Result = TEXT
Formula = 
Lookupfield_r.BillingStreet + BR() + 
Lookupfield_r.BillingCity + ", "+ 
Lookupfield_r.BillingState +" " + 
Lookupfield_r.BillingPostalCode + BR() + 
Lookupfield_r.BillingCountry
Alexis KasperaviciusAlexis Kasperavicius
Manually coding the address field really isn't an answer if you have addresses across the globe.

For example addresses in many countries in Europe list the postal code first, then the city and state. i suppose you could get fancy and write some sort of concatenated formula field that figures this out, but really?

What's frustating is Salesforce already does this and displays the addresses correctly based on location but there is no way I have yet discovered to output this formatting to say, do a postal mailing.

Something doesn't feel right here. There must be a way to get out the formatted address to print labels. What is it?