+ Start a Discussion
kolakishore.salesfo1.3895976580747668E12kolakishore.salesfo1.3895976580747668E12 

IF( Seats_Category__c = Box),100 IF( Seats_Category__c = Class-A),75 IF(Seats_Category__c= Class_B),50 IF(Seats_Category__c= Class-C),25,0 ) ) ) )

Hi ,

Could anyone help me out in the below function..Actually i need to apply to formula to the field which depends on some other field.
I created a picklist field which contains BOX,Class-A,Class_B,Class-C.
If anyone selected BOX in that picklist field then automatically Ticket fare has to reflect as 100,if they selected Class-A then 75 has to reflect and so on.....

I written a formula....But it is not working out...

IF( Ispickval(Seats_Category__c ," Box"),100
Ispickval( Seats_Category__c ,"Class-A"),75
 Ispickval(Seats_Category__c," Class_B"),50
   Ispickval(Seats_Category__c," Class-C"),25,0
       )
   
Best Answer chosen by kolakishore.salesfo1.3895976580747668E12
Steve MolisSteve Molis
You could also use a CASE function instead of a Nested IF like this =>

CASE(Seats_Catagory__c,
"Box",100,
"Class-A",75,
"Class-B",50,
"Class-C",25,
0)

All Answers

DevADSDevADS
Hey Kishor,

Try this:
Select return type as Number for the following formula field:

IF(ISPICKVAL( Seats_Category__c, 'Box'),100,
    IF(ISPICKVAL(Seats_Category__c, 'Class-A'),75,
        IF(ISPICKVAL(Seats_Category__c, 'Class-B'),50,
            IF(ISPICKVAL(Seats_Category__c,'Class-C'),25,0))))


Happy Coding!!
Ashish_SFDCAshish_SFDC
Hi Kishore,

The class-b had an _ underscore - check if it meets the picklist value.

I had tried the below formula, works perfect, try in your environment. 

IF (Ispickval(Seats_Catagory__c,"Box"),100,
IF (Ispickval(Seats_Catagory__c,"Class-A"),75,
IF (Ispickval(Seats_Catagory__c,"Class-B"),50,
IF (Ispickval(Seats_Catagory__c,"Class-C"),25,0))))

Regards,
Ashish
kolakishore.salesfo1.3895976580747668E12kolakishore.salesfo1.3895976580747668E12
Thank you Ashish...........Its working man......... Regards, Kishore
kolakishore.salesfo1.3895976580747668E12kolakishore.salesfo1.3895976580747668E12
Thanks Amit...........Its working
Steve MolisSteve Molis
You could also use a CASE function instead of a Nested IF like this =>

CASE(Seats_Catagory__c,
"Box",100,
"Class-A",75,
"Class-B",50,
"Class-C",25,
0)
This was selected as the best answer
Chandra PrakashChandra Prakash
Hi ,
IF(ISPICKVAL( Seats_Category__c, 'Box'),"100",IF(ISPICKVAL(Seats_Category__c, 'Class-A'),"75",IF(ISPICKVAL(Seats_Category__c, 'Class-B'),"50",IF(ISPICKVAL(Seats_Category__c,'Class-C'),"25","0"))))

------------------------------------
Chandra Prakash Sahrma

ImmyImmy
I think Steve molis option is better to use for reducing code .Am I write ??
Ashish_SFDCAshish_SFDC
Hi Immy, 


Thats correct, 

Ispickval simplifies the logic but Case is a Good Programming Practice. 


Regards,
Ashish