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
Markus SchormannMarkus Schormann 

Validation Rule Adding Percent Field Values

Dear all, 
I have 3 custom percent fields and want to create a validation rule with these conditions:
  • either Field 1 = 100%
  • or Field 1 + 2 = 100%
  • or Field 1 + 2 + 3 = 100%
I tried to set it up like this but unfortunately it didn't work, the validation fired although sum of field 1&2 was 100%
 
OR(Field1__c <>1,
Field1__c + Field2__c <> 1,
Field1__c + Field2__c + Field3__c <> 1)

Kindly advise

Thanks and best

Markus

 
Best Answer chosen by Markus Schormann
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Markus,

Can you try the below.

Replace Percentage3__c with field3, Percentage2__c with field2, Percentage1__c with field1
IF( AND(ISBLANK( Percentage3__c ), Percentage1__c + Percentage2__c <>1),TRUE, IF(AND(ISBLANK( Percentage3__c ),ISBLANK( Percentage2__c ),Percentage1__c<>1 ),TRUE, IF(AND(NOT(ISBLANK( Percentage3__c )),NOT(ISBLANK( Percentage2__c )),NOT(ISBLANK( Percentage1__c )),Percentage1__c + Percentage2__c+Percentage3__c <>1),TRUE,FALSE)
)
)

If this solution helps, Please mark it as best answer.

Thanks,
 

All Answers

Sai PraveenSai Praveen (Salesforce Developers) 
Hi Markus,

I hope you should be using AND condition as it is negative scenerio. Can you try the below rule.
 
AND(Field1__c <>1,
Field1__c + Field2__c <> 1,
Field1__c + Field2__c + Field3__c <> 1)

If this solution helps, Please mark it as best answer.

Thanks,
 
Markus SchormannMarkus Schormann
Hi Sai,

thank you for your reply. Unfortunately this change wasn't the solution, now the Validation rule isn't firing at all.
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Markus,

I have tested using the above formula and it is working. I have given 20,30,20 in the three field and so the validation rule got fired. Can you specify what values you have given.

Thanks,
 
Markus SchormannMarkus Schormann
Hi Sai

Oddly this fires when Field1__c + Field2__c + Field3__c <> 1 but not when Field1__c + Field2__c <> 1 OR Field1__c <>1
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Markus,

Can you try the below.

Replace Percentage3__c with field3, Percentage2__c with field2, Percentage1__c with field1
IF( AND(ISBLANK( Percentage3__c ), Percentage1__c + Percentage2__c <>1),TRUE, IF(AND(ISBLANK( Percentage3__c ),ISBLANK( Percentage2__c ),Percentage1__c<>1 ),TRUE, IF(AND(NOT(ISBLANK( Percentage3__c )),NOT(ISBLANK( Percentage2__c )),NOT(ISBLANK( Percentage1__c )),Percentage1__c + Percentage2__c+Percentage3__c <>1),TRUE,FALSE)
)
)

If this solution helps, Please mark it as best answer.

Thanks,
 
This was selected as the best answer