+ Start a Discussion

Validation rule using if condition

How to write Validation rule using if condition can any one help


Can you post a specific example of what you are trying to do with the VR? 

If you're just looking for infomation on the usage of an IF function there are some resources available here->



Below is the sample code of Validation Rules using IF condition -


            IF(MOD(TestNumber__c ,10) != 0, true, false)


            It basically checks if TestNumber__c field is not in multiple of 10 i.e. it will be true for the values :

            0, 10, 20, 30, 40, 50, 60, 70,80, 90, 100

Hi Pradeep

I am also trying the same validation rule like above ..but it is not working for "Percent" field. Any work around on this??

Thanks in Advance
Madhu N 31Madhu N 31
if syntax
Malika Pathak 9Malika Pathak 9

Hi anitha20,

find the below solution

The trick here is not to check if the record has changed was an admin or another user, simply check the user's profile and if is valid or not then through the expectation if it returns true then it shows an error message.
if(user.profile == "Admin" , true,false)

If you find this helpful mark it as the Best Answer.

pritam bishwaspritam bishwas
I want create Account Number validate through validation rule.