In Salesforce, entering a value with more decimal places than the field definition allows in a Number, Currency, or Percent field causes the system to round and save the value by default. This article explains how to prevent input values from being modified unintentionally by using the MOD function in a Validation Rule. The Validation Rule displays an error message when an input exceeds the specified number of decimal places.
This article explains how the Validation Rule formula logic works to prevent Salesforce from silently rounding a Number, Currency, or Percent field value that exceeds its configured "Decimal Places" setting.
The logic used in the Validation Rule formula is to "shift the decimal point to the right (by multiplying), and if a decimal value still remains (the remainder when divided by 1 is not 0), trigger an error."
To evaluate the value, multiply the number by 100 to shift the decimal point two places to the right.
Set the number of zeros for multiplication according to the number of decimal places you want to limit.
Example: To limit to "2 decimal places":
MOD( FieldName__c * 100, 1 ) <> 0
Note: Replace FieldName__c with the API Name of your Number or Currency field. Because we want to check up to the 2nd decimal place, we multiply by 100 (two zeros) to shift the decimal point.
Percent fields are stored in the database as a value divided by 100 (e.g., 10% is stored as 0.1). Therefore, in addition to the visible decimal places on the screen, you must account for the digits used for the percentage conversion.
Example: To limit to "2 decimal places" as displayed on the screen:
MOD( FieldName__c * 10000, 1 ) <> 0
Note: Replace FieldName__c with the API Name of your Percent field. You need to shift by a total of 4 digits: the "2 decimal places" visible on the screen plus the "invisible 2 digits" (due to the /100 storage specification). Therefore, multiply by 10,000 (four zeros).
005132292

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.