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
Guru Vemuru 1Guru Vemuru 1 

How to use Else IF Condition in formula field?

Hi Every one,
                     I have three check boxes and it have different input fields. When i select perticular checkbox respective amount field should display. same for other two also. So I have to check three conditions and respective field have to fetch.

Here is my formula:
IF(Travel_Request__r.Cash_Advance__c ==True, Travel_Request__r.Amount__c ,0,
Else If(Travel_Request__r.Travel_Card_Loaded__c ==True,  Travel_Request__r.Travel_card_Amount__c , 0 ),
Else if( Travel_Request__r.Travelers_Cheque__c ==True,( Travel_Request__r.Denomination__c * Travel_Request__r.Quantity__c),0))
)  

How can i do it with out else condition.
Pavit SiddhuPavit Siddhu
Use OR instead of else.
Guru Vemuru 1Guru Vemuru 1
I checked it but it is not working because it returns boolean, we need currency return type.
 
Maharajan CMaharajan C
Try the below formula with return type currency in formula field.

IF(Travel_Request__r.Cash_Advance__c ==True, Travel_Request__r.Amount__c ,If(Travel_Request__r.Travel_Card_Loaded__c ==True, Travel_Request__r.Travel_card_Amount__c , if( Travel_Request__r.Travelers_Cheque__c ==True,( Travel_Request__r.Denomination__c * Travel_Request__r.Quantity__c),0)))

Can you please Let me know if it works or not!!!

If it helps don't forget to mark this as a best answer!!!

Thanks,
​Raj

 
Guru Vemuru 1Guru Vemuru 1
Hi Maharaj,
                 Thanks for your response and formula is saved but it is not working properly means if i select second check box ,2nd IF condition fetching data. Only first IF condition executing.
Veena GopalVeena Gopal
Hello Guru,  where are u using this formula?
Guru Vemuru 1Guru Vemuru 1
Hi Maharaj,
                 Yes I did same but it taking First condition in IF Expression.  No There is no Else in Formula field it is not checking second condition.
Guru Vemuru 1Guru Vemuru 1
Hello Veena,
  In order fetch datafrom other related object Based on criteria condition. 
Maharajan CMaharajan C
We don't need to use the else condtion in formula field.

Generaly Multiple IF condtion will works like If Else method [syntax: If(condition,truevalue,falsevalue) -- > IF(condition,true, IF(condition,true,false)).

Can you please test it properly.

Thanks,
​Raj


 
Guru Vemuru 1Guru Vemuru 1
Maharaj i tested but it is  not working.
Veena GopalVeena Gopal
Hi Guru, are you putting the formula in validation rule or in workflow or in process builder.
When i asked where you are putting i meant where in the salesforce?
Veena GopalVeena Gopal
which formula field?
Guru Vemuru 1Guru Vemuru 1
Hi Veena,
             Formula for updating field.