# Complex Data Input Limitations

by Allen Wyatt
(last updated June 15, 2019)

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 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

Unwanted Numbering on Pasted Tables

When pasting text from another document or from the Web you can have unexpected characters sometimes show up. Many of ...

Discover More

Determining Columns in a Range

If you need to know the number of columns in a particular range, you can use the COLUMNS worksheet function. This tip ...

Discover More

Monthly Close-Out Dates

If your company closes out its accounting months at the end of each calendar quarter, figuring out the proper closing ...

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)

Single-Use Drop-Down List

Want to create an easy drop-down list? You can do so by using the data validation features of Excel.

Discover More

Handling Validation for Proper Latitude

When setting up Excel for data entry, you often have to be concerned with what values are acceptable. For example, if ...

Discover More

Making a Drop-Down List Indicator Visible

Data validation allows you to create drop-down lists that aid data entry. If you want the indicator for the drop-down ...

Discover More
##### Subscribe

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

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 seven more than 0?

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.