You need to sign in to do that
Don't have an account?

Validation rule for currency with 2 decimal values
Valid: 12.00, 12.10, 12.01, 12.56
Not Valid: 12, 12.1, 12.0
NOT(REGEX(TEXT(Price__c), "[0-9]+[.][0-9][0-9]?"))
I am writing an validation rule for currency field. Can anyone help me with this.
Not Valid: 12, 12.1, 12.0
NOT(REGEX(TEXT(Price__c), "[0-9]+[.][0-9][0-9]?"))
I am writing an validation rule for currency field. Can anyone help me with this.
Logic : Get the Decimal point and then convert it to Text. Check the length.
Len(Text(Price__c- (ROUND(Price__c ,0))))<2
Note : If the decimal points are 0 or 1, the above condition becomes true and the validation error is thrown.
Note : If this answers your question, please mark this as an Answer. Thus others can get help too.
Please try this code :
NOT(REGEX(Price__c,"[0-9]+[.]{1}[0-9]{2}"))
Thanks
----------
Chandra Prakash Sharma
Bisp Solutions Inc.
you can use this one too:
NOT(REGEX(Right(Currency_text__c,3), "[.]{1}[0-9]{2}"))
NOT(REGEX(Right(Price__c,3), "[.]{1}[0-9]{2}")) :)
Error: Incorrect parameter type for function 'Right()'. Expected Text, received Number
This is the error i am gettting.
use this
NOT(REGEX(Right(TEXT(Price__c),3), "[.]{1}[0-9]{2}"))
and put Decimal places : 2
and put
Vivekh
you should try this formula
if it helpful
NOT(REGEX(Price__c,"[0-9]+[.]{1}[0-9]{2}"))
its accepted 12.00,12.10,12.20 etc. value and it not accepted 12.1,12 etc value..
Regards,
Chandra Prakash Sharma
Bisp Solutions Inc.
http://bispsolutions.com
i am trying to make a validation rule for a text field with 2 decimal values just like 20/30,40/50,1/2,12/4 and single numbers.
It should give error message if it is like 122/22 or 299/349.
Here i wrote a validation rule :
NOT(REGEX(Edited_Discount__c,"[0-9]+[/]{1}[0-9]{2}"))
It will Validate 20/30,40/50 but when i give single it throws validation exception.
Please help me on this .
Thanks
Lisa