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

Scanning and Fixing System Files

Is your system running a bit flakey at times? If you think the culprit might be a problem with some of your system files, ...

Discover More

Automatically Using Smart Quotes

As a way to make your documents look more professional, Word can utilize "smart quotes" for both quote marks and ...

Discover More

Problem with Missing Context Menu Option

When you right-click a cell, does it seem that the Context menu is missing an item or two? Here's how to get those items ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (ribbon)

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

Ensuring Unique Values in a Column

If you want to make sure that only unique values are entered in a particular column, you can use the data validation ...

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 two more than 7?

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.