+ Start a Discussion
sfadm sfadmsfadm sfadm 

Formula in a Validation Rule not functioning as intended

I'm using the following formula in a validation rule:
IF(ISPICKVAL( Level_Name__c ,"Level"),
IF(RIGHT(Name, 3) == TEXT(Level_Name__c), TRUE, FALSE), FALSE)
How can I get the last three characters of the Name and compare with Level_Name__c except for the "Level" value?



 
Best Answer chosen by sfadm sfadm
Bala Gangadhar VadlamuriBala Gangadhar Vadlamuri
Dear Sfadm,
Try this
AND( ISPICKVAL( Level_Name__c ,"Level"), 
IF(BEGINS( TEXT(Level_Name__c),RIGHT(Name, 3)) , TRUE, FALSE) )
​​​​​​
You dont need to use if if you are using ispickvalue.

Regards,
Bala

All Answers

Raj VakatiRaj Vakati
Try tis
 
AND(
IF(ISPICKVAL( Level_Name__c ,"Level")),
IF(BEGINS( TEXT(Level_Name__c),RIGHT(Name, 3) , TRUE, FALSE))
)

 
sfadm sfadmsfadm sfadm

@Raj
I've tried precisely the way you suggested but I get the following errror:

Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 1
Please advise.
Raj VakatiRaj Vakati
AND(
IF(ISPICKVAL( Level_Name__c ,"Level") , true ,false),
IF(BEGINS( TEXT(Level_Name__c),RIGHT(Name, 3) , TRUE, FALSE))
)

 
sfadm sfadmsfadm sfadm

Still get an error:

Error: Incorrect number of parameters for function 'BEGINS()'. Expected 2, received 4
Raj VakatiRaj Vakati
AND(
IF(ISPICKVAL( Level_Name__c ,"Level")),
IF(BEGINS( TEXT(Level_Name__c),RIGHT(Name, 3)) , TRUE, FALSE)
)

Hope no more errors .. use above
sfadm sfadmsfadm sfadm
Still now working, Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 1  
Bala Gangadhar VadlamuriBala Gangadhar Vadlamuri
Dear Sfadm,
Try this
AND( ISPICKVAL( Level_Name__c ,"Level"), 
IF(BEGINS( TEXT(Level_Name__c),RIGHT(Name, 3)) , TRUE, FALSE) )
​​​​​​
You dont need to use if if you are using ispickvalue.

Regards,
Bala
This was selected as the best answer