Complex Data Input Limitations

Written by Allen Wyatt (last updated November 13, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


Prakash would like to restrict input data in a cell such that it accepts only a maximum of 11 digits before the decimal point and, possibly, 2 digits after. The input can be either an integer or decimal value, but it can only have a maximum of 11 digits to the left of the decimal and 2 to the right. (Thus, 1234 or 1234.56 would be acceptable, but 1234.567 would not.) Prakash notes that Data Validation doesn't seem to work when you want to limit digits both before and after the decimal point.

Prakash is close to finding the answer, because Data Validation can actually be used. The trick is to create a custom formula that can be used for the validation. Here's a formula that will return either True or False, as is required for Data Validation:

=AND(A1=ROUND(A1,2),ABS(A1)<100000000000)

The formula tests two conditions using AND, with both conditions needing to be true. The first condition checks to make sure that no more than 2 digits are used to the right of the decimal point. The second condition compares the absolute value to make sure it is less than 12 digits. It checks against 12 digits so that a value such as 99999999999.99 is considered valid.

In order to use the formula in Data Validation, follow these steps:

  1. Select the cell or cells for which you want the Data Validation applied.
  2. Display the Data tab of the ribbon.
  3. In the Data Tools group, click the Data Validation tool. (The Data Validation tool is in the Data Validation group if you are using Excel 2007 or Excel 2010.) Excel displays the Data Validation dialog box.
  4. Using the Allow drop-down list, choose Custom. (See Figure 1.)
  5. Figure 1. The Data Validation dialog box.

  6. In the Formula box, type the formula noted earlier.
  7. Set any other data validation settings as desired.
  8. Click OK.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13643) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 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

Jumping to an Endnote

Endnotes are often used in documents to document citations and sources. You can jump from endnote to endnote using the ...

Discover More

Inserting Symbols

Using the Character Map to insert symbols in Excel.

Discover More

Anchoring Objects by Default

When you position objects (such as text boxes or graphics) on a page, one of the things you can do is to anchor the ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Contingent Validation Lists

Data validation can be used to create lists of choices for entry into a particular cell. Using the techniques in this tip ...

Discover More

External Data Validation

When using data validation, you may want to reference a list of validation criteria contained on a different worksheet. ...

Discover More

Using Data Validation

Want to control what users put into a cell? It's easy to do using a feature called data validation, as described in this tip.

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}] (all 7 characters, in the sequence shown) 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 nine minus 5?

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.