+ Start a Discussion
Mark McGraneMark McGrane 

Validation Rules Nested Ifs

Hi There,

I am having a few issues with populating a Formula Field as I need to run nested IFs on it.

Basically what I am looking to do is to determine a rating based on the Business Type and last bill amount

So if the Business has previous consumption

The Rating for Gyms is A-, Rating For Hotels is B-, Rating For Offices is C-

If there is no consumption

Then The Rating for Gyms is A+, Rating For Hotels is B+, Rating For Offices is C+

Im pretty sure its something small but I keep getting "Error: Syntax error. Missing ')'
Best Answer chosen by Mark McGrane
RKSalesforceRKSalesforce
Hi Mark,

Please use below formula , Return type of your Formula Field Shpuld be Text:
IF( ISPICKVAL(Does_The_Customer_Have_Consumption__c, 'Yes') , 
IF(ISPICKVAL(BusinessType__c, 'Gyms'), 'A-', IF(ISPICKVAL(BusinessType__c, 'Hotels'), 'B-','C-')) , IF(ISPICKVAL(BusinessType__c, 'Gyms'), 'A+', IF(ISPICKVAL(BusinessType__c, 'Hotels'), 'B+','C+')))
Please mark as best answer if helped.

Regards,
Ramakant
 

All Answers

RKSalesforceRKSalesforce
Hi Mark,

Please post your vlidation rule here.

Regards,
Ramakant
Mark McGraneMark McGrane
Hi Ramakant,

IF((ISPICKVAL(Does_The_Customer_Have_Consumption__c, "Yes")

IF((ISPICKVAL(BusinessType__c,"Gyms") , "A-"),
(ISPICKVAL(BusinessType__c,"Hotels") , "B-"),
(ISPICKVAL(BusinessType__c,"Offices") , "C-")),


IF((ISPICKVAL(BusinessType__c,"Gyms") , "A+"),
(ISPICKVAL(BusinessType__c,"Hotels") , "B+"),
(ISPICKVAL(BusinessType__c,"Offices") , "C+"))))
RKSalesforceRKSalesforce
Hi Mark,

Please use below formula , Return type of your Formula Field Shpuld be Text:
IF( ISPICKVAL(Does_The_Customer_Have_Consumption__c, 'Yes') , 
IF(ISPICKVAL(BusinessType__c, 'Gyms'), 'A-', IF(ISPICKVAL(BusinessType__c, 'Hotels'), 'B-','C-')) , IF(ISPICKVAL(BusinessType__c, 'Gyms'), 'A+', IF(ISPICKVAL(BusinessType__c, 'Hotels'), 'B+','C+')))
Please mark as best answer if helped.

Regards,
Ramakant
 
This was selected as the best answer
Mark McGraneMark McGrane
Thanks Ramakant. Seems like I was missing a comma. :-)