Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Limiting Entries to Numeric Values.

Limiting Entries to Numeric Values

by Allen Wyatt
(last updated July 3, 2015)

14

Gary has a worksheet that people in his office use for data entry. He wants to make sure that in a particular cell they can only enter a numeric value. He wonders how to stop them from entering other entries—like text or dates or times—in the cell.

The easiest way to do this is to use Excel's data validation feature. This feature allows you to define the parameters of what can be entered in a cell. Follow these steps:

  1. Select the cell you want used for inputting a value.
  2. Choose Validation from the Data menu. Excel displays the Settings tab of the Data Validation dialog box. (See Figure 1.)
  3. Figure 1. The Settings tab of the Data Validation dialog box.

  4. Using the Allow drop-down list, choose either Whole Number or Decimal, depending on which type of numeric input you want to allow. Excel changes the controls available in the dialog box.
  5. Using the Data drop-down list, make sure Between is selected.
  6. Enter in the Minimum and Maximum boxes the lower and upper bounds of what you want users to enter in the cell.
  7. On the other tabs of the dialog box, enter an input message and an error message, if desired.
  8. Click OK.

People can now enter only a numeric value within the range you specified. The one exception to this is dates and times. Since they are maintained internally, by Excel, as numbers, it is possible to enter a date, provided the date is parsed into a numeric value that is within the range you specify.

For instance, if you set up data validation to only allow values between 20,000 and 21,000, then someone could enter a date of 6/11/1956 because Excel parses the date to the whole number 20,617. The best way to handle dates and times is to format the cell so that it uses a numeric format, which will stop Excel from displaying dates and times.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2425) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Limiting Entries to Numeric Values.

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

Setting the Calculation Default

Excel can recalculate your worksheets either automatically or manually. The default is to calculate them automatically, ...

Discover More

Calculating the First Business Day of the Month

Want to know which day of the month is the first business day? There are a few ways you can check to make sure the date ...

Discover More

Modifying Behavior of the Open Dialog Box

The Open dialog box is one that few of us think about, but you can control how it behaves with a little bit of macro coding. ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

MORE EXCELTIPS (MENU)

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, as ...

Discover More

Changing Fonts in Data Validation Drop-Down Lists

The data validation capabilities of Excel allow you to easily create drop-down lists showing what data is acceptable for a ...

Discover More

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
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 for this tip:

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. 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 7 + 8?

2017-01-05 21:53:47

jamie ford

Hi Allen,
Is there a way to restrict the input to a cell to text?
I'm setting up a spreadsheet and want to restrict the type of entry in the cells.

Some are numeric and using validation works well for those cells.
Some are alpha and validation doesn't seem to work in the way I want.
When I validate the cell for text it lets me input numbers into the cell when I use it.

Some insights would be much appreciated.

Regards
Jamie


2016-11-01 14:58:26

Marc

Thank you.


2016-07-14 07:09:47

Naveen N

Hi, This solution is creating the drop down list. which is very limited. where has i need to restrict the cell only for numeric entry it may be combination of any thing from 0 to 9 and the length of 6 only.

Please suggest me a way out.


2016-06-22 07:14:29

karthik

I want to prevent the users to enter more than a specific value in a column..for example if i set 100 is the highest value for that cell, users can only enter less than 100.if they enter more than that error msg should popup.

I want to know how to set a high value for the cell and error popup option. can someone helpme....


2016-04-19 15:25:52

Andy

This works for typing in values but not for copying/pasting values. I can set a field to numeric only like you say and can't type in anything but a number, but I can paste anything in there I want. Is there a fix for that?


2015-10-24 07:55:51

Reddy

I am not sure if i can use data validation for this. I want restrict users from entering the following numbers in a range/cell - 10, 24, 35, 60, 70 and 80. How do i do this? Please advise


2015-08-18 07:32:29

RIDDHI

@ Willy Vanhaelen

THANK YOU SO MUCH. THOUGH I COULD NOT UNDERSTAND LOGIC, BUT ITS WORKING. FANTASTIC.


2015-08-18 06:38:38

Willy Vanhaelen

@riddhi,
Oops, I have been a little too hasty. The formula I proposed earlier will be true for i.e. 2A34B.

This formula will do a better job:
=AND(LEN(A1)=5,ISNUMBER(VALUE(MID(A1,3,2))),NOT(ISNUMBER(VALUE(LEFT(A1,1)))),NOT(ISNUMBER(VALUE(MID(A1,2,1)))),NOT(ISNUMBER(VALUE(RIGHT(A1,1)))))

The validation will accept any non-number for the first 2 and last characters such as A or B but also for i.e. a space or punctuation mark. If this is a problem then you'll need a user defined function because a classic formula would become extremely long.


2015-08-18 05:31:51

Willy Vanhaelen

@riddhi,

This formula should do:

=AND(LEN(A1)=5,ISNUMBER(VALUE(MID(A1,3,2))),ISTEXT(LEFT(A1,2)&RIGHT(A1,1)))


2015-08-17 07:06:07

riddhi

I have many codes which are in format of AB11A.(1st two and last letter alphabetic and, 3rd and 4th letter in numeric)

I want to make formula in such a way that excel doesnt accept number if any one type number in 1st, 2nd and 3rd position and it doest accept alphabetical if any one type in 3rd and 4th position.

In short in 1st,2nd and 5th place, excel accept only alphabecs and in 3rd and 4th it accept only numerical.


2014-10-17 09:31:10

Azim

Hello sir

I have a query that is there any way that when i entered FIRST TIME anything in my cell, it will lock automatically LOCK so that no one can edit it and Delete it.


2014-08-09 02:43:02

Surya

How to permit the user to enter either letter 'A' or a whole number between zero to sixty, in to a cell?


2013-08-11 09:40:25

Abhinandan

Hello Sir,
I just subscribed you for excel.
I have a question. Please help me...

Is it possible to limit the data range depending upon value selected in drop down list.
Suppose i have a drop down list (say in cell M1)which has 5 options, namely Refrigerator, TV, Mixer, Micro oven, Speaker.
Now i want to limit the data entered in cell X20 depending upon the option selected.
For example:
For TV maximum value allowed to be entered in cell X20 = 1000$, For refrigerator 800 $ and so on....
Is it possible to do in excel 2010? If it is possible, tell me how to do it.
Thanks & Regards


2013-08-11 09:38:14

Abhinandan

Is it possible to limit the data range depending upon value selected in drop down list.
Suppose i have a drop down list (say in cell M1)which has 5 options, namely Refrigerator, TV, Mixer, Micro oven, Speaker.
Now i want to limit the data entered in cell X20 depending upon the option selected.
For example:
For TV maximum value allowed to be entered in cell X20 = 1000$, For refrigerator 800 $ and so on....
Is it possible to do in excel 2010?
Thanks & Regards


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.

Links and Sharing
Share