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
Hm_inviHm_invi 

If condition in formula field to update the address in report?

I have a requirement to update the address of an account in the Report. 
This address is suposed to the Billing and if it is not updated then shipping address. If both billing and shipping are not available then the address in the report should be blank.

Since this if condition logic is not possible in Report, i have created a bunch of formula fields. 
1. BillingAddress__c- Billing address Text formula field to concate all the billing address in one field-  .
2. ShippingAddress__c- Shipping address Text formula field to concate all the billing address in one field-.

Both the above fields are working fine.

3.DeliveryAddress__c- Text formula field to update the billing address and if it is blank shipping address to be updated else blank.
This field is used in report.
 
IF( NOT( ISBLANK(BillingAddress__c)) , BillingAddress__c, 
     IF(NOT( ISBLANK(ShippingAddress__c)), ShippingAddress__c, ' ')
  )
IF(  ISBLANK(BillingAddress__c) , 
     IF( ISBLANK(ShippingAddress__c), ShippingAddress__c, ''), 
     BillingAddress__c 
  )

No syntax error and same result from both the above formulas.
the billing address is  updating in 3 field when it is not blank.
But when billing address is blank the shipping address is not blank, the filed update in 3 is not happening. 

i have used ISNULL() as well but no difference.

Is there anything that i'm missing?

Thanks.
Drisya D 13Drisya D 13
Hi @Hm_invi,

As per below link, If statement will evaluate the first condition and assign the value if it is true and stops evaluating the second condition. 

https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A9BjCSAV

As a workaround we can use the below formula:

IF(NOT( ISBLANK(BillingAddress__c)) , BillingAddress__c,' ') +
IF(NOT( ISBLANK(Shippingaddress__c)) , Shippingaddress__c,' ')

User-added image

Regards,
Drisya