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

Searching for Tabs

Tabs don't normally show up in your printed document, but Word allows you to still search for them. All you need to do is ...

Discover More

Calculating the Interval between Occurrences

With a long list of items in a worksheet, you may want to determine the last time a particular item appeared in the list. ...

Discover More

Using Strikethrough Formatting

Need a line through the middle of your text? Use strikethrough formatting, which is easy to apply using the Format Cells ...

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)

Creating Dependent Drop-Lists

Drop-down lists are handy in an Excel worksheet, and you they can be even more handy if a selection in one drop-down ...

Discover More

Specifying a Data Validation Error Message

Data validation is a great tool for limiting what can be input into a cell. Excel allows you to specify what should ...

Discover More

Limiting Entries to Numeric Values

When creating a worksheet, you may need to limit what can be entered into a particular cell. Using data validation you ...

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 1 + 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.