+ Start a Discussion
Gitakul0121Gitakul0121 

Formula Trifecta Help:CASE, IF statement, AND, ISPICKVAL all in one dirty li'l formula!

Trying to build a formula to calculate a to a field called Discount based on 2 fields:

1. A picklist

2. A Quantity (#)

 

Basically if:

Solution Type = Student Solution and Quantity is <= 10, then set Discount to 10

Solution Type = Student Solution and Quantity is > 10 and <=49, then set Discount to 30

Solution Type = Student Solution and Quantity is >= 50, then set Discount to 70

Solution Type = Teacher Solution and Quantity is 0, then set Discount to 40

 

I tried 2 lines before considering the other cases and it failed....wah!

CASE (

IF (AND (ISPICKVAL(Soution Type_c, "Student Solution"), Quantity_c <=10, 10,

(AND (ISPICKVAL(Soution Type_c, "Student Solution"), Quantity_c >10, 30,

0)

 

I keep getting a Expected Boolan and receive number message.Can you help me here??

 

Thanks,

Gita

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
matermortsmatermorts

I would just go the "if" route all the way

 

IF ((ISPICKVAL (Solution_Type__c, 'Student Solution') && Quantity__c <= 10), 10,
  IF ((ISPICKVAL (Solution_Type__c, 'Student Solution') && Quantity__c > 10 && Quantity__c <= 49), 30,
   IF ((ISPICKVAL (Solution_Type__c, 'Student Solution') && Quantity__c >= 50), 70,
    IF ((ISPICKVAL (Solution_Type__c, 'Teacher Solution') && Quantity__c = 0), 40, 0
   )
  )
 )
)

 

All Answers

matermortsmatermorts

I would just go the "if" route all the way

 

IF ((ISPICKVAL (Solution_Type__c, 'Student Solution') && Quantity__c <= 10), 10,
  IF ((ISPICKVAL (Solution_Type__c, 'Student Solution') && Quantity__c > 10 && Quantity__c <= 49), 30,
   IF ((ISPICKVAL (Solution_Type__c, 'Student Solution') && Quantity__c >= 50), 70,
    IF ((ISPICKVAL (Solution_Type__c, 'Teacher Solution') && Quantity__c = 0), 40, 0
   )
  )
 )
)

 

This was selected as the best answer
Gitakul0121Gitakul0121

It worked matermorts!!!!

 

You are da bestest! :)

 

Will you marry me?