[SalesForce] Validation Rule for Currency field with Max 2 decimal places

I am trying to create a validation rule for currency field which will take the maximum 2 decimal places only if you put the third decimal value it will should give you an error.

My currency field is having 16 numbers and 2 decimal places.

For e.g

Valid number – 12, 112.23,14.01,15.00
Invalid Number – 12.23455

Please find the below regular Expression which i am using in the validation rule

NOT(REGEX(TEXT(Amount__c), "[0-9]+[.][0-9][0-9]?"))

Thanks,

Best Answer

Just do this:

Amount__c <> ROUND(Amount__c, 2)

If there's a difference, this formula returns an error.

Related Topic