Limiting Input to Two Decimal Places

by Allen Wyatt
(last updated December 29, 2018)

Ashley wonders how to limit the input of a number to 2 decimal places. In trying to figure it out, she notes that the Data Validation tool does not seem to work for this requirement.

There are two ways you can approach this problem. The first is to use a custom rule in Excel's Data Validation tool. Follow these steps:

  1. Select the cell where you want to limit the input to two decimal places. (For this example, let's assume you select cell A1.)
  2. Display the Data tab of the ribbon.
  3. Click the Data Validation tool. Excel displays the Data Validation dialog box.
  4. Make sure the Settings tab is displayed. (See Figure 1.)
  5. Figure 1. The Settings tab of the Data Validation dialog box.

  6. In Allow drop-down list, choose Custom.
  7. In the Formula box (which appears when you complete step 5), enter the following formula:
     =MOD(A1*100,1)=0
  • Click OK to close the dialog box.
  • This validation formula works because it checks to make sure that the value in A1, when multiplied by 100 and then divided by 1, has no remainder. It will only have this remainder if there are three or more decimal places in the value entered. Validation will also fail if someone tries to enter text into cell A1.

    There are, of course, any number of other formulas you could use in step 6. Here are a few:

    =INT(A1*100)=(A1*100)
    =A1=ROUND(A1,2)
    =ABS(A1-ROUND(A1,2))<1E-8
    =FIND(".",A1,1)>=LEN(A1)-2
    

    Instead of using Data Validation, there is another approach you could take. This one involves using the following steps:

    1. Select the cell where you want to limit the input to two decimal places. (For this example, let's assume you select cell A1.)
    2. Format the cell as desired, but make sure it is at least formatted to display only two decimal places.
    3. Display the Excel Options dialog box. (In Excel 2007 click the Office button and then click Excel Options. In Excel 2010 and later versions display the File tab of the ribbon and then click Options.)
    4. Click the Advanced option at the left of the dialog box.
    5. Scroll through the available options until you see the When Calculating This Workbook section. (See Figure 2.)
    6. Figure 2. The Advanced options of the Excel Options dialog box.

    7. Ensure that the Set Precision as Displayed check box is selected.
    8. Click OK.

    Now, when someone enters a value into the cell you formatted in step 2, it will be rounded to two decimal places automatically, and Excel will make sure that any calculations use the two-decimal-place value.

    The drawback to this approach is that changing how Excel does its calculations (steps 3 through 6) affects the entire workbook, not just the data-entry cell selected in step 1. If this is unacceptable to you, then you should definitely choose the Data Validation approach, discussed earlier.

    ExcelTips is your source for cost-effective Microsoft Excel training. This tip (889) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365.

    Author Bio

    Allen Wyatt

    With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

    MORE FROM ALLEN

    Editing Word's Built-in Commands

    Want to configure Word to do just what you want it to? You can even go so far as to change the actual way in which Word ...

    Discover More

    Adding and Using a Combo Box

    Combo boxes can be a great way of getting user input in a worksheet. Here's how to add a combo box to your worksheet and ...

    Discover More

    Can't Save Formatted AutoCorrect Entries

    How you go about creating an AutoCorrect entry can be an important part of what you can do with that entry. Here's an ...

    Discover More

    Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

    More ExcelTips (ribbon)

    Adding Pop-Up Documentation to a Cell

    Want to have a small help screen pop up when a user selects a particular cell? This can be done by using data validation, ...

    Discover More

    Answering Questions in Order

    It is not unusual to use Excel to gather the answers to users' questions. If you want your users to answer your questions ...

    Discover More

    Limiting Entry of Prior Dates

    Want to establish a "bottom limit" on what dates can be entered in a cell? This tip presents two different ways you can ...

    Discover More
    Subscribe

    FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

    View most recent newsletter.

    Comments

    If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

    What is two minus 1?

    There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


    This Site

    Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

    Newest Tips
    Subscribe

    FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

    (Your e-mail address is not shared with anyone, ever.)

    View the most recent newsletter.