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
Diego MorenoDiego Moreno 

​validation rule for currency field with 2 decimal values. URGENT

hello

i am trying to make a validation rule for a currency field with 2 decimal values so that it only enables the user to put .00 .25 .50 and .75, with any other value in the decimals i need it to trigger the erro message.
this is what i've got so far:

NOT(REGEX(TEXT( Gross_Pay__c ), "[0-9]+[.]{1}[25,50]{2}")) it works for 25 and other values but not for 50

it has to be a validation rule with REGEX.
Best Answer chosen by Diego Moreno
mjohnson-TICmjohnson-TIC
Probably a cleaner way, but this should work.

AND( 
RIGHT(TEXT(Gross_Pay__c*100),2) <> '00', 
RIGHT(TEXT(Gross_Pay__c*100),2) <> '25', 
RIGHT(TEXT(Gross_Pay__c*100),2) <> '50', 
RIGHT(TEXT(Gross_Pay__c*100),2) <> '75')

All Answers

mjohnson-TICmjohnson-TIC
Probably a cleaner way, but this should work.

AND( 
RIGHT(TEXT(Gross_Pay__c*100),2) <> '00', 
RIGHT(TEXT(Gross_Pay__c*100),2) <> '25', 
RIGHT(TEXT(Gross_Pay__c*100),2) <> '50', 
RIGHT(TEXT(Gross_Pay__c*100),2) <> '75')
This was selected as the best answer
Diego MorenoDiego Moreno
it worked thanks!