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
Mark McGraneMark McGrane 

Validation Formula With Syntax Error

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 if the last bill has consumption.

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 ')'




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+"))))
Best Answer chosen by Mark McGrane
Alain CabonAlain Cabon
The error is misleading because it is a comma at first.

IF((ISPICKVAL(Does_The_Customer_Have_Consumption__c, "Yes") ,   // you need a comma here

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+"))))

Not tested but a comma is missing for sure.

All Answers

Alain CabonAlain Cabon
The error is misleading because it is a comma at first.

IF((ISPICKVAL(Does_The_Customer_Have_Consumption__c, "Yes") ,   // you need a comma here

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+"))))

Not tested but a comma is missing for sure.
This was selected as the best answer
Mark McGraneMark McGrane
Hi,

Thanks for that, got it working. Nested IFs caused a headache, but yes, the comma was the problem :-)